Skip to content

Instantly share code, notes, and snippets.

@simevidas
Last active September 21, 2015 17:30
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save simevidas/0d612a731f8edaa758cf to your computer and use it in GitHub Desktop.
Save simevidas/0d612a731f8edaa758cf to your computer and use it in GitHub Desktop.
A summary of Nicolas Bevacqua’s post on ES6 Number improvements

ES6 Number improvements

  • use the 0b prefix for binary, and the 0o prefix for octal integer literals
  • Number.isNaN and Number.isFinite are like their global namesakes, except that they don’t coerce the argument to Number
  • Number.parseInt and Number.parseFloat are exactly the same as their global namesakes
  • use Number.isInteger to check if the argument is a Number value that doesn’t have a decimal part
  • use Number.EPSILON to check if the difference between two Number values is negligible (e.g. the difference between 0.1 + 0.2 and 0.3 is negligible)
  • Number.MAX_SAFE_INTEGER and Number.MIN_SAFE_INTEGER are the largest and smallest integers that can be safely and precisely represented in JavaScript
  • use Number.isSafeInteger to check if an integer is within those bounds

Read the full blog post here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment