chroma-syntaxis/samples/fizzbuzz.js

18 lines
286 B
JavaScript
Raw Normal View History

const fizzbuzz = n => {
if (n % 15 == 0)
return "Fizz buzz";
if (n % 3 == 0)
return "Fizz";
if (n % 5 == 0)
return "Buzz";
return n;
}
const main = () => {
for (let n = 1; n <= 100; n++) {
console.log(fizzbuzz(n));
}
};
main();