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 divide operator is represented by a slash (/):
let result = 66 / 11;
The divide operator has special behaviors for special values.
NaN
, the result is NaN
. Number()
and then the other rules are applied. let firstNumber = 15; let secondNumber = 10; let answer;//from w ww . j a v a 2s . co m answer = 15 / 10; console.log(answer); console.log(15 / 10); answer = firstNumber / secondNumber; console.log(answer);