fizzbuzz question code example
Example 1: hackerrank fizzbuzz javascript
for (i=1; i<=100; i++) {
console.log((i%3==0&&i%5==0)?"FizzBuzz":(i%3==0)?"Fizz" : (i%5==0)?"Buzz" : i);
}
Example 2: FizzBuzz
for (let i = 1, msg; i <= 100; i++, msg = '') {
if (!(i % 3)) msg += 'Fizz';
if (!(i % 5)) msg += 'Buzz';
console.log(msg || i);
}