My first javascript files
- Prints the numbers from 1 to 100 in the console BUT:
- If a number is divisible by 3 print "Java" instead
- If a number is divisible by 5 print "Buzz" instead
- If a number is divisible by 3 and 5 print "JavaBuzz" instead
- Use Jasmine to Test-Drive Development
- Write FizzBuzz in JavaScript, fully test-driven
- Refactor the code so it's clean.
Walkthrough for jasmine TDD process for Javabuzz
Debugging and console.log loop example
- Clone the repo
- cd into the directory
- Open SpecRunner.html in a browser
open SpecRunner.html
- In the same browser window where your SpecRunner.html is loaded up, open your console (Google Chrome shortcut is cmd + option + i).
Because of the console.log loop, you will see the javabuzz outputs for numbers 1-100.
If you also want to check individual numbers, you can initialise an instance of Javabuzz();
in the console prompt:
var javabuzz = new Javabuzz();
and then throw some numbers at it:
> javabuzz.says(3)
<- "Java"
> javabuzz.says(5)
<- "Buzz"
> javabuzz.says(15)
<- "Javabuzz"
> javabuzz.says(1)
<- 1