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

Js in bits - (datatypes - BigInt)

Susan Sarandon
Release: 2024-12-27 04:21:12
Original
817 people have browsed it

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!

source:dev.to
Statement of this Website
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
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template