- A Syntax error
- B Missing of semicolons
- C Division by zero
- D Missing of Bracket
- Share this MCQ
In JavaScript, dividing any number by zero does not result in an error.
Instead, the result of the division is positive or negative infinity, depending on the signs of the operands.
For example:
console.log(5 / 0); // prints "Infinity"
console.log(-5 / 0); // prints "-Infinity"
Dividing zero by zero results in the special value NaN, which stands for "Not a Number."
This is because the result of the division is undefined, as there is no defined number that can be obtained by dividing zero by zero.
For example:
console.log(0 / 0); // prints "NaN"
It is important to be aware of the special values Infinity and NaN in JavaScript, as they can cause problems if not handled properly.
For example, if you try to perform arithmetic operations with Infinity or NaN as an operand,
the result may not be what you expect.
It is important to understand how these special values work and to use them carefully in your code.
Share this MCQ