76 lines
1.7 KiB
Markdown
76 lines
1.7 KiB
Markdown
|
---
|
||
|
title: Happy numbers
|
||
|
id: 594810f028c0303b75339ad1
|
||
|
challengeType: 5
|
||
|
videoUrl: ''
|
||
|
localeTitle: ''
|
||
|
---
|
||
|
|
||
|
## Description
|
||
|
undefined
|
||
|
|
||
|
## Instructions
|
||
|
undefined
|
||
|
|
||
|
## Tests
|
||
|
<section id='tests'>
|
||
|
|
||
|
```yml
|
||
|
tests:
|
||
|
- text: ''
|
||
|
testString: 'assert(typeof happy === "function", "<code>happy</code> is a function.");'
|
||
|
- text: ''
|
||
|
testString: 'assert(typeof happy(1) === "boolean", "<code>happy(1)</code> should return a boolean.");'
|
||
|
- text: ''
|
||
|
testString: 'assert(happy(1), "<code>happy(1)</code> should return true.");'
|
||
|
- text: ''
|
||
|
testString: 'assert(!happy(2), "<code>happy(2)</code> should return false.");'
|
||
|
- text: ''
|
||
|
testString: 'assert(happy(7), "<code>happy(7)</code> should return true.");'
|
||
|
- text: ''
|
||
|
testString: 'assert(happy(10), "<code>happy(10)</code> should return true.");'
|
||
|
- text: ''
|
||
|
testString: 'assert(happy(13), "<code>happy(13)</code> should return true.");'
|
||
|
- text: ''
|
||
|
testString: 'assert(happy(19), "<code>happy(19)</code> should return true.");'
|
||
|
- text: ''
|
||
|
testString: 'assert(happy(23), "<code>happy(23)</code> should return true.");'
|
||
|
- text: ''
|
||
|
testString: 'assert(happy(28), "<code>happy(28)</code> should return true.");'
|
||
|
- text: ''
|
||
|
testString: 'assert(happy(31), "<code>happy(31)</code> should return true.");'
|
||
|
- text: ''
|
||
|
testString: 'assert(happy(32), "<code>happy(32)</code> should return true:.");'
|
||
|
- text: ''
|
||
|
testString: 'assert(!happy(33), "<code>happy(33)</code> should return false.");'
|
||
|
|
||
|
```
|
||
|
|
||
|
</section>
|
||
|
|
||
|
## Challenge Seed
|
||
|
<section id='challengeSeed'>
|
||
|
|
||
|
<div id='js-seed'>
|
||
|
|
||
|
```js
|
||
|
function happy (number) {
|
||
|
// Good luck!
|
||
|
}
|
||
|
|
||
|
```
|
||
|
|
||
|
</div>
|
||
|
|
||
|
|
||
|
|
||
|
</section>
|
||
|
|
||
|
## Solution
|
||
|
<section id='solution'>
|
||
|
|
||
|
```js
|
||
|
// solution required
|
||
|
```
|
||
|
</section>
|