TDD a pure function that takes a integer number and returns a string of all numbers up to and including the supplied number, except:
- Numbers evenly divisable by 3 should be replace with
Fizz
- Numbers evenly divisable by 5 should be replace with
Bizz
- Numbers evenly divisable by 3 and 5 should be replace with
FizzBuzz
For example, calling the function with 16 would return:
1, 2, Fizz, 4, Buzz, Fizz, 7, 8, Fizz, Buzz, 11, Fizz, 13, 14, FizzBuzz, 16
- Tool: Use 3rd-party testing library
- Variables: Declaring and assign
const
variable - Variables: Assign variable from property of global object
- Testing: TDD a pure function
- Functions: Calling a function
- Functions: Using an anonymous function as a function argument
- Functions: Define function parameter
- Testing: Test assertions with
assert.equal
- ESModules:
export default
andimport
default - Variables: Declare
let
variable with sensible default - Variables: Reassign
let
variable in a loop - Strings: String concatenation with
+
and+=