Skip to content
Advertisement

How to initialise a variable in Javascript to INFINITE value?

How can I initialise a variable in javascript to the biggest possible number? I am looking for an equivalent of:

Integer.MAX_VALUE –> Java

INT_MAX –> C

int.MaxValue –> C#

Advertisement

Answer

With the new added ECMAScript feature MAX_SAFE_INTEGER

console.log(Number.MAX_SAFE_INTEGER)
Advertisement