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

Find out what "n" after a number means 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.


Hope you found this post useful. It was published . Please show your love and support by sharing this post.