Computer Science, asked by Roshanf5725, 1 year ago

Positive and negative infinity numbers in javascript

Answers

Answered by Anonymous
3

Answer:

function checkNumber(bigNumber) {

if (bigNumber === Number.POSITIVE_INFINITY) {

return 'Process number as Infinity';

}

return bigNumber;

}

console.log(checkNumber(Number.MAX_VALUE));

// expected output: 1.7976931348623157e+308

console.log(checkNumber(Number.MAX_VALUE * 2));

// expected output: Process number as Infinity

Similar questions