Browse Source

discovery-js: add additional loop exercise

pull/788/head
Clement Denis 3 years ago
parent
commit
d57c9e3a21
  1. 10
      js/tests/count-up-to.json
  2. 10
      subjects/count-up-to/README.md

10
js/tests/count-up-to.json

@ -0,0 +1,10 @@
[
{
"description": "Count up to 3",
"code": "const args = saveArguments(console, 'log')\n\n// Your code\n\nupTo(3)\nequal(\n args.flat().join('\\n'),\n `0\n1\n2\n3`,\n)"
},
{
"description": "Count up to 11",
"code": "const args = saveArguments(console, 'log')\n\n// Your code\n\nupTo(11)\nequal(\n args.flat().join('\\n'),\n `0\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11`,\n)"
}
]

10
subjects/count-up-to/README.md

@ -0,0 +1,10 @@
## Count up to
### Instructions
Declare `upTo` function that takes an `end` number argument.
You must log each number starting at `0` until you reach the `end` value
(included)
> Example: `upTo(3)` would log: 0 1 2 3
Loading…
Cancel
Save