A
Q. Which of the following is not considered as an error in JavaScript?
- Correct Answer - Option(D)
- Views: 14
- Filed under category JavaScript
- Hashtags:
A
In JavaScript, dividing a number by zero does not throw an error. Instead, it returns Infinity (or -Infinity for negative numbers). JavaScript handles division by zero gracefully, unlike some other languages where it may cause an error.
Example:
console.log(10 / 0); // Output: Infinity
console.log(-10 / 0); // Output: -Infinity
However, if the value is 0/0, it results in NaN (Not-a-Number):
console.log(0 / 0); // Output: NaN
Why Not Other Options?
Final Answer:
✅ (D) Division by zero (It returns Infinity instead of throwing an error).
You must be Logged in to update hint/solution
Be the first to start discuss.
Discusssion
Login to discuss.