DEV Community

loading...

Discussion on: FizzBuzz challenge in as many languages as possible

Collapse
ap13p profile image
Afief S

Language: Javascript
Code:

const array = Array.from(Array(100).keys()).map(it => it + 1)
  .map(it => it % 3 === 0 && it % 5 === 0 ? 'FizzBuzz' : it)
  .map(it => typeof it === 'number' && it % 3 === 0 ? 'Fizz' : it)
  .map(it => typeof it === 'number' && it % 5 === 0 ? 'Buzz' : it)

console.log(array)