|
|
|
|
|
by dontchooseanick
1162 days ago
|
|
Commenting on the last exercise, "loops" on https://javascript.sumankunwar.com.np/ The average functional programmer writes this - and not a for loop : ````
const fizzbuzz = (n)=>(n%15==0)?"FizzBuzz":(n%5==0)?"Buzz":(n%3==0)?"Fizz":n;
Array(101).fill(0).map((_,i)=>fizzbuzz(i))
````
|
|
Also, can't help but snark that apparently the "average" FP is so preoccupied with showing off their one-liners that they fail the problem requirements (should be `Array(100).fill(0).forEach((_,i)=>console.log(fizzbuzz(i+1)))`).