Exercise 2.2
FizzBuzz
for(var i = 1; i < 101; i++){
if(i % 3 == 0 && i % 5 !==0 ){
console.log("Fizz");
}else if(i % 5 == 0 && i % 3 !== 0){
console.log("Buzz");
}else if(i % 3 == 0 && i % 5 ==0 ){
console.log("FizzBuzz");
} else {
console.log(i);
}
}
To open the JavaScript console, press F12 or on MAC press COMMAND-OPTION-I.