1function fizzBuzz2(n) {
2 for (let i = 1; i <= n; i++) {
3 let str = "";
4
5 if (i % 3 === 0) str += "fizz"
6 if (i % 5 === 0) str += "buzz"
7 if (str === "") str = i;
8
9 console.log(str);
10 }
11}
12
1for (i=1; i<=100; i++) {
2 console.log((i%3==0&&i%5==0)?"FizzBuzz":(i%3==0)?"Fizz" : (i%5==0)?"Buzz" : i);
3}
4
1function fizzBuzz(n) {
2 // Write your code here
3 for(let i = 1; i <= n; i++) {
4
5 if(i % 3 == 0 && i % 5 == 0) {
6 console.log('FizzBuzz')
7 }
8 else if(i % 3 == 0) {
9 console.log('Fizz')
10 } else if(i % 5 == 0) {
11 console.log('Buzz')
12 } else {
13 console.log(i)
14 }
15 }
16}