Home >Web Front-end >JS Tutorial >Js in bits - (datatypes - BigInt)

Js in bits - (datatypes - BigInt)

Susan Sarandon
Susan SarandonOriginal
2024-12-27 04:21:12816browse

Learning js should be fun. It is fun if it's easy.
I tried my best in writing this, to understand it easily.

datatypes

BigInt

There are very large numbers like 9007199254740995(2^53) and Js can't store them using Number data type.

Js in bits - (datatypes - BigInt)

If we do the following calculation, Js stores the approx value.
Below, 1 is added & Js can't store the result with Number datatype.

Js in bits - (datatypes - BigInt)

Solution: BigInt

Adding n to the end of the number tells Js that it is a BigInt datatype. Js can successfully store the very large number.

Js in bits - (datatypes - BigInt)

Leave y'r thoughts....

The above is the detailed content of Js in bits - (datatypes - BigInt). For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn