There are three multiplicative operators in Javascript: multiply, divide, and modulus.
If either of the operands for a multiplication operation isn't a number, it is converted to a number using the Number()
casting function.
An empty string is treated as 0, and the Boolean value of true is treated as 1.
The modulus (remainder) operator is represented by a percent sign (%):
let result = 26 % 5; // equal to 1
The modulus operator behaves differently for special values, as follows:
NaN
. NaN
. NaN
. Number()
and then the other rules are applied. for (let i = 1; i < 26; i++) { console.log(i + ","); if ((i % 5) == 0) { console.log("\n"); }// ww w .ja va 2 s. com }