What is Data Type?
Data Type is type of values. All of the data in JavaScript have data type.
Allocatation of memory space by Data Type
All of values used in programming language can be stored in memory and referenced. To store values in memory, computer need to know the size of memory space it need. Because size of memory depends on data type.
JavaScript uses a double-precision 64-bit floating-point format when creating numeric binary values.
Access memory by Data Type
When refer to memory space by identifier, computer need to know the size of memory it need to read once. If variable soup
is Number type, computer should access memory by only 8 byte. Data Type provides that informations to computer and human.
Here’s reasons why Data Type need:
- To determine the size of memory space that must be free when storing values
- To determine how much memory space should be read at once when referring to a value
- To determine how to interpret the binary be read from memory. (To Number, String etc.)