Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

fizz buzz program in javascript

//Fizz buzz
/* Divisible by 3 = fizz*/
/* Divisible by 5 = buzz*/
/* Divisible by both = fizzBuzz*/
// range 100

for(let numberRange = 1; numberRange <= 100; numberRange++){
    if(numberRange % 3 === 0 && numberRange % 5 === 0) {
        console.log('fizzBuzz');
    }else if(numberRange % 3 === 0){
        console.log('fizz');
    }else if(numberRange % 5 === 0){
        console.log('buzz')
        ;
    }else {
        console.log(numberRange);
    }
}
 
PREVIOUS NEXT
Tagged: #fizz #buzz #program #javascript
ADD COMMENT
Topic
Name
9+1 =