Q. JavaScript _________ when there is an indefinite or an infinite value during an arithmetic computation.
In JavaScript, when an arithmetic computation results in an indefinite or infinite value, JavaScript does not throw an error. Instead, it returns Infinity (or -Infinity for negative values).
Example:
console.log(10 / 0); // Output: Infinity
console.log(-10 / 0); // Output: -Infinity
If the result of a computation is undefined (like 0/0), JavaScript returns NaN (Not-a-Number):
console.log(0 / 0); // Output: NaN
Why Not Other Options?
- (A) Prints the value as such โ โ Incorrect (JavaScript does not print raw values; instead, it handles them specifically as Infinity).
- (B) Prints an exception error โ โ Incorrect (JavaScript does not throw an exception for division by zero).
- (C) Prints an overflow error โ โ Incorrect (JavaScript does not have an "overflow error" like some other languages).
Final Answer:
โ (D) Displays โInfinityโ