Skip to content

Instantly share code, notes, and snippets.

View andreobriennz's full-sized avatar

Andre O'Brien andreobriennz

View GitHub Profile
@andreobriennz
andreobriennz / functional-fizzbuzz.js
Last active July 26, 2019 05:35
Functional / Declarative FizzBuzz
const isFizz = number => number % 5 === 0
const isBuzz = number => number % 3 === 0
const newArrayInRange = (min, max) => [...Array(max + 1).keys()].slice(min)
const fizzBuzz = (min, max) => newArrayInRange(min, max)
.map(number => {
if (isFizz(number) && isBuzz(number)) {
return 'fizzbuzz'
}