In JavaScript, if we add a finite number to infinity, the answer will be infinity. Therefore, if we try to add Math.PI
to Infinity
, the answer will be infinity.
Here's the code:
index.tsx85 chars3 lines
If you want to check if a number is equal to infinity or not, you can use the isFinite()
function. Here's an example:
index.tsx92 chars3 lines
In this case, the isFinite()
function will return false
because the result is infinity, which is not a finite number.
gistlibby LogSnag