how to write fizzbuzz in javascript

index.tsx
for (let i = 1; i <= 100; i++) {
  if (i % 3 === 0 && i % 5 === 0) {
    console.log("FizzBuzz");
  } else if (i % 3 === 0) {
    console.log("Fizz");
  } else if (i % 5 === 0) {
    console.log("Buzz");
  } else {
    console.log(i);
  }
}
241 chars
12 lines

This code will output the numbers from 1 to 100, but for multiples of 3 it will print "Fizz" instead of the number, for multiples of 5 it will print "Buzz" and for multiples of both 3 and 5, it will print "FizzBuzz".

gistlibby LogSnag