A
Q. When there is an indefinite or an infinity value during an arithmetic value computation, javascript
- Correct Answer - Option(C)
- Views: 12
- Filed under category JavaScript
- Hashtags:
A
In JavaScript, when an arithmetic operation results in an infinite value (e.g., division by zero or exceeding the largest representable number), JavaScript does not throw an error. Instead, it represents the result as Infinity or -Infinity, depending on the sign of the operation.
Examples:
console.log(1 / 0); // Output: Infinity
console.log(-1 / 0); // Output: -Infinity
console.log(10 ** 1000); // Output: Infinity (Number too large)
console.log(-10 ** 1000); // Output: -Infinity
This behavior ensures that JavaScript handles extreme values gracefully without stopping the execution of the script.
You must be Logged in to update hint/solution
Be the first to start discuss.
Discusssion
Login to discuss.