Numeric Separators in JavaScript

Numeric Separators give us the ability to separate thousands with an underscore (_) in numeric literals.

How it’s useful❓

It makes our code more informative and readable.

Numeric Separators in javascript, enables underscore as a separator in numeric literals to improve readability.


You can also use this for binary, octal, and hex numbers.

Binary Number: 👻

Octal Number: 👻

Hex Number: 👻

Few Limitation 🤦‍♀️

Below limitation snippet will throw SyntaxError

  1. More than one underscore in a row is not allowed

2. Can not be used after leading 0

3. Not allowed at the end of numeric literals

Browser Support 🎗

This feature has pretty good support in recent versions of browsers.

Check this out 👇

Reference 🧐

🌟 Twitter | 👩🏻‍💻 | 🌟 Instagram

Frontend Developer sharing JS, HTML, CSS, GoLang🔥 Find all on💛

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store