
正文
JavaScript data types and data structures
提示:扫一扫查出行【扫一扫了解最新限行尾号】
复制提示
JavaScript data types and data structures
Programming languages all have built-in data structures, but these often differ from one language to another.
This article attempts to list the built-in data structures available in JavaScript and what properties they have;these can be used to build other data structures.
Wherever possible, comparisons with other languages are drawn.
Dynamic typing
JavaScript is a loosely typed or a dynamic language.
Variables in JavaScript are not directly associated with any particular value type, and any variable can be assigned (and re-assigned) values of all types:
var foo = 42; // foo is now a number
foo = 'bar'; // foo is now a string
foo = true; // foo is now a boolean
Data types
The latest ECMAScript standard defines eight data types:
- Seven data types that are primitives:
- Boolean
- Null
- Undefined
- Number
- BigInt
- String
- Symbol
- and Object







