-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfizz.js
More file actions
24 lines (22 loc) · 771 Bytes
/
fizz.js
File metadata and controls
24 lines (22 loc) · 771 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
function fizzBuzz(n) {
// Write your code here
let range = n => [...Array(n).keys()]
let rangeArr = range(5)
rangeArr.map(el => {
el = el + 1
if((el % 3) === 0 && (el % 5) === 0) {
console.log(el , (el % 3), (el % 5))
console.log('FizzBuzz')
} else if ( (el %3 ) === 0 && (el % 5) !=0 ) {
console.log(el, (el % 3), (el % 5))
console.log('Fizz')
} else if ((el % 5) === 0 && (el % 3) != 0) {
console.log(el, (el % 3), (el % 5))
console.log('Buzz')
} else if ( (el % 3) != 0 && (el % 5) !=0) {
console.log(el, (el % 3), (el % 5))
console.log(el)
}
})
}
fizzBuzz()