Really nice idea!
Here's how I did it 😁
const fizzBuzz = (number) => { const array = Array(number).fill(undefined).map((_, index) => index + 1); const fiz = array.filter(v => !(v % 3)) const baz = array.filter(v => !(v % 5)) const fizBaz = array.filter(v => !(v % 5) && !(v % 3)) let result = {}; for (let i of array) { result[i] = i; } for (let f of fiz) { result[f] = 'Fizz'; } for (let b of baz) { result[b] = 'Buzz'; } for (let fb of fizBaz) { result[fb] = 'FizzBuzz'; } return Object.values(result); }
Glad you liked it!
I just published a new challenge if you want another one :)
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Really nice idea!
Here's how I did it 😁
Glad you liked it!
I just published a new challenge if you want another one :)
[Challenge] log("this") or log("this").withData({})
Manolo Edge ・ Aug 19 ・ 1 min read