What Does "n" at the End of a Number Mean in JavaScript?

The "n" at the end of an integer literal merely suggests that the value is a bigint primitive. Bigint values (introduced in ES10) are used to represent arbitrarily large integers. For example:

// ES10+
const MAX_SAFE_INTEGER = 9007199254740991n;

Appending "n" at the end of an integer literal is one of the ways you can create a bigint value.

If you wish to get rid of the n from an existing bigint value, then you can simply convert it to a string or number.


This post was published by Daniyal Hamid. Daniyal currently works as the Head of Engineering in Germany and has 20+ years of experience in software engineering, design and marketing. Please show your love and support by sharing this post.