How many bytes are there in integers in JavaScript
This article mainly introduces the number of bytes of integers in JavaScript, with a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, let the editor take you to understand it.
In JavaScript, integers have 8 bytes; number memory space share is not specific to specific types, basic variable types use eight bytes of memory, and numbers and integers are stored as 64-bit floating-point numbers, that is, 8 bytes.
The operating environment of this tutorial: windows10 system, javascript1.8.5 version, Dell G3 computer.
How many bytes are there in integers in JavaScript
Let's start with the number type number.
"JavaScript number types are represented by 64-bit floating-point numbers defined by the IEEE754 standard"-excerpt from the Rhino Book
The following picture is the explanation in mdn
Note: the memory space share of number does not distinguish between specific types (Java is differentiated). Integer types (byte, short, int, long) and floating point types (float, double)
Therefore, for numbers only, the memory in the computer is 8Byte, or 8 bytes.
1byte (bytes) = 8bit (bits)
8byte = 64 bit
Extend other data types
The JavaScript basic data type occupies 8 bytes of memory in the computer.
Basic data types: string, number, undefined, boolean, null
Generally speaking, there are 2 bytes in Chinese and 1 byte in English.
Thank you for reading this article carefully. I hope the article "how many bytes are there in JavaScript" shared by the editor will be helpful to you. At the same time, I also hope you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!