Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Add an else statement in case the number is divisible by 5.
- // for the numbers 1 through 20,
- for (i=1; i<=20; i++) {
- // if the number is 15, write "Fizzbuzz"
- if ( i === 15; ) {
- console.log("Fizzbuzz");
- }
- // if the number is divisible by 3, write "Fizz"
- else if ( i % 3 === 0 ) {
- console.log("Fizz");
- }
- // if the number is divisible by 5, write "Buzz"
- else if ( i % 5 === 0 ) {
- console.log("Buzz");
- }
- // otherwise, write just the number
- else {
- console.log(i);
- }
- }
- // SyntaxError: missing ) after condition
Add Comment
Please, Sign In to add comment