function fizzBuzz(n) { for (let i = 1; i <= n; i++) { i % 15 === 0 ? console.log('fizzbuzz') : i % 3 === 0 ? console.log('fizz') : i % 5 === 0 ? console.log('buzz') : console.log(i); } }
function fizzBuzz(num) {for (let i=1;i <= num; i++) {if (i%3===0) {console.log("fizz");};if (i%5===0) {console.log("buzz");}if (i%15===0) {console.log("fizzbuzz");}}};fizzBuzz(15); //- function fizzBuzz(n) {
- for (let i = 1; i <= n; i++) {
- i % 15 === 0 ? console.log('fizzbuzz')
- : i % 3 === 0 ? console.log('fizz')
- : i % 5 === 0 ? console.log('buzz')
- : console.log(i);
- }
- }