diff --git a/js/tests/count-up-to.json b/js/tests/count-up-to.json new file mode 100644 index 00000000..15e2afce --- /dev/null +++ b/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)" + } +] \ No newline at end of file diff --git a/subjects/count-up-to/README.md b/subjects/count-up-to/README.md new file mode 100644 index 00000000..164a3552 --- /dev/null +++ b/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