2018-10-10 18:03:03 -04:00
|
|
|
---
|
|
|
|
id: 59669d08d75b60482359409f
|
|
|
|
challengeType: 5
|
|
|
|
videoUrl: ''
|
2020-10-01 17:54:21 +02:00
|
|
|
title: 日期格式
|
2018-10-10 18:03:03 -04:00
|
|
|
---
|
|
|
|
|
|
|
|
## Description
|
|
|
|
<section id="description">任务: <p>返回包含以下格式的当前日期的数组: </p><p> - 2007-11-23和</p><p> - 2007年11月23日星期日</p><p>示例输出: <code>['2007-11-23', 'Sunday, November 23, 2007']</code> </p></section>
|
|
|
|
|
|
|
|
## Instructions
|
|
|
|
<section id="instructions">
|
|
|
|
</section>
|
|
|
|
|
|
|
|
## Tests
|
|
|
|
<section id='tests'>
|
|
|
|
|
|
|
|
```yml
|
|
|
|
tests:
|
|
|
|
- text: <code>getDateFormats</code>是一个函数。
|
2020-02-18 01:40:55 +09:00
|
|
|
testString: assert(typeof getDateFormats === 'function');
|
2018-10-10 18:03:03 -04:00
|
|
|
- text: 应该返回一个对象。
|
2020-02-18 01:40:55 +09:00
|
|
|
testString: assert(typeof getDateFormats() === 'object');
|
2018-10-10 18:03:03 -04:00
|
|
|
- text: 应该返回一个包含2个元素的数组。
|
2020-02-18 01:40:55 +09:00
|
|
|
testString: assert(getDateFormats().length === 2);
|
2018-10-10 18:03:03 -04:00
|
|
|
- text: 应以正确的格式返回正确的日期
|
2020-02-18 01:40:55 +09:00
|
|
|
testString: assert.deepEqual(getDateFormats(), dates, equalsMessage);
|
2018-10-10 18:03:03 -04:00
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
</section>
|
|
|
|
|
|
|
|
## Challenge Seed
|
|
|
|
<section id='challengeSeed'>
|
|
|
|
|
|
|
|
<div id='js-seed'>
|
|
|
|
|
|
|
|
```js
|
|
|
|
function getDateFormats () {
|
|
|
|
// Good luck!
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
### After Test
|
|
|
|
<div id='js-teardown'>
|
|
|
|
|
|
|
|
```js
|
|
|
|
console.info('after the test');
|
|
|
|
```
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</section>
|
|
|
|
|
|
|
|
## Solution
|
|
|
|
<section id='solution'>
|
|
|
|
|
|
|
|
```js
|
|
|
|
// solution required
|
|
|
|
```
|
2020-08-13 17:24:35 +02:00
|
|
|
|
|
|
|
/section>
|