...And the good! explanation


#1

need the explanation about below line in the code

' i % 3 === 0 '

for (var i = 1; i <= 20; i++){
if ((i % 3 === 0) && (i % 5 === 0)){
console.log("FizzBuzz");
}
else if (i % 5 === 0){
console.log("Buzz");
}
else if (i % 3 === 0){
console.log("Fizz");
}
else {
console.log(i);
};
};

#2

the modulo operator (%) calculates the remainder (explanation of remainder), if the remainder equals zero, a number is divisible by the divider (in this case 3)


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.