Feat: add new Markdown parser (#39800)
and change all the challenges to new `md` format.
This commit is contained in:
committed by
GitHub
parent
a07f84c8ec
commit
0bd52f8bd1
@ -5,51 +5,63 @@ challengeType: 5
|
||||
forumTopicId: 302300
|
||||
---
|
||||
|
||||
## Description
|
||||
|
||||
<section id='description'>
|
||||
# --description--
|
||||
|
||||
Determine whether a given year is a leap year in the Gregorian calendar.
|
||||
|
||||
</section>
|
||||
# --hints--
|
||||
|
||||
## Instructions
|
||||
`isLeapYear` should be a function.
|
||||
|
||||
<section id='instructions'>
|
||||
|
||||
</section>
|
||||
|
||||
## Tests
|
||||
|
||||
<section id='tests'>
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: <code>isLeapYear</code> should be a function.
|
||||
testString: assert(typeof isLeapYear == 'function');
|
||||
- text: <code>isLeapYear()</code> should return a boolean.
|
||||
testString: assert(typeof isLeapYear(2018) == 'boolean');
|
||||
- text: <code>isLeapYear(2018)</code> should return <code>false</code>.
|
||||
testString: assert.equal(isLeapYear(2018), false);
|
||||
- text: <code>isLeapYear(2016)</code> should return <code>true</code>.
|
||||
testString: assert.equal(isLeapYear(2016), true);
|
||||
- text: <code>isLeapYear(2000)</code> should return <code>true</code>.
|
||||
testString: assert.equal(isLeapYear(2000), true);
|
||||
- text: <code>isLeapYear(1900)</code> should return <code>false</code>.
|
||||
testString: assert.equal(isLeapYear(1900), false);
|
||||
- text: <code>isLeapYear(1996)</code> should return <code>true</code>.
|
||||
testString: assert.equal(isLeapYear(1996), true);
|
||||
- text: <code>isLeapYear(1800)</code> should return <code>false</code>.
|
||||
testString: assert.equal(isLeapYear(1800), false);
|
||||
```js
|
||||
assert(typeof isLeapYear == 'function');
|
||||
```
|
||||
|
||||
</section>
|
||||
`isLeapYear()` should return a boolean.
|
||||
|
||||
## Challenge Seed
|
||||
```js
|
||||
assert(typeof isLeapYear(2018) == 'boolean');
|
||||
```
|
||||
|
||||
<section id='challengeSeed'>
|
||||
`isLeapYear(2018)` should return `false`.
|
||||
|
||||
<div id='js-seed'>
|
||||
```js
|
||||
assert.equal(isLeapYear(2018), false);
|
||||
```
|
||||
|
||||
`isLeapYear(2016)` should return `true`.
|
||||
|
||||
```js
|
||||
assert.equal(isLeapYear(2016), true);
|
||||
```
|
||||
|
||||
`isLeapYear(2000)` should return `true`.
|
||||
|
||||
```js
|
||||
assert.equal(isLeapYear(2000), true);
|
||||
```
|
||||
|
||||
`isLeapYear(1900)` should return `false`.
|
||||
|
||||
```js
|
||||
assert.equal(isLeapYear(1900), false);
|
||||
```
|
||||
|
||||
`isLeapYear(1996)` should return `true`.
|
||||
|
||||
```js
|
||||
assert.equal(isLeapYear(1996), true);
|
||||
```
|
||||
|
||||
`isLeapYear(1800)` should return `false`.
|
||||
|
||||
```js
|
||||
assert.equal(isLeapYear(1800), false);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function isLeapYear(year) {
|
||||
@ -57,17 +69,10 @@ function isLeapYear(year) {
|
||||
}
|
||||
```
|
||||
|
||||
</div>
|
||||
</section>
|
||||
|
||||
## Solution
|
||||
|
||||
<section id='solution'>
|
||||
# --solutions--
|
||||
|
||||
```js
|
||||
function isLeapYear(year) {
|
||||
return year % 100 === 0 ? year % 400 === 0 : year % 4 === 0;
|
||||
}
|
||||
```
|
||||
|
||||
</section>
|
||||
|
Reference in New Issue
Block a user