DEV Community

Discussion on: [Challenge] 🐝 FizzBuzz without if/else

Collapse
jselbie profile image
John Selbie • Edited on

My javascript solution, modeled after my C++ solution and then reduced

function fizzbuzz(N) {
    for (let i = 1; i <= N; i++) {
         let fb = ["", "Fizz", "Buzz", i.toString()];
         console.log(fb[(!(i % 3) + 0)]+fb[((!(i % 5)) * 2)]+fb[(((i%3!=0) && (i%5!=0))+0) * 3]);
    }
}