| [ Web Proxy ] |
| Viewing: https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Guide/Data_structures | [Back] [Original] |
Get to know MDN better
let foo = 42; // foo
foo = "bar"; // foo
foo = true; // foo
const foo = 42; // foo
const result = foo + "1"; // JavaScript foo
console.log(result); // 421
null typeof typeof null "object" === null null
null undefined Number toExponential() JavaScript null undefined TypeError
typeof |
||
|---|---|---|
| Null | "object" |
|
| Undefined | "undefined" |
|
| Boolean | "boolean" |
Boolean |
| Number | "number" |
Number |
| BigInt | "bigint" |
BigInt |
| String | "string" |
String |
| Symbol | "symbol" |
Symbol |
Null null
Undefined undefined
undefined null typeof null === "object"JavaScript undefined
return return; undefinedobj.iDontExist undefinedlet x; undefinedArray.prototype.find() Map.prototype.get() undefinednull Object.getPrototypeOf()Object.create() null undefined
Boolean true false
Number IEEE 754 64 2-1074Number.MIN_VALUE 21023 (2 - 2-52)Number.MAX_VALUE -(253 1)Number.MIN_SAFE_INTEGER 253 1Number.MAX_SAFE_INTEGERJavaScript Number.isSafeInteger()
Number.MAX_VALUE +InfinityNumber.MIN_VALUE +0Number.MAX_VALUE -InfinityNumber.MIN_VALUE -0+Infinity -Infinity Number.POSITIVE_INFINITY Number.NEGATIVE_INFINITY
Number -0 +0 0 0 +0 +0 === -0 true 0
console.log(42 / +0); // Infinity
console.log(42 / -0); // -Infinity
NaNNot a Number JavaScript
BigInt JavaScript BigInt Number Number.MAX_SAFE_INTEGER
BigInt n BigInt()
// BigInt
const x = BigInt(Number.MAX_SAFE_INTEGER); // 9007199254740991n
x + 1n === x + 2n; // false 9007199254740992n 9007199254740993n
// Number
Number.MAX_SAFE_INTEGER + 1 === Number.MAX_SAFE_INTEGER + 2; // true 9007199254740992
BigInt +*-** % >>>BigInt Number
BigInt number BigInt BigInt number TypeError
String UTF-16 16 0 1 UTF-16 Unicode String
JavaScript
fetch() Response.text() API JavaScript
Symbol Symbol symbol
JavaScript symbol
JavaScript Object.defineProperty() Object.getOwnPropertyDescriptor() Object.defineProperty()
valueget JavaScript
writableenumerableconfigurableget set
JavaScript
get get getter undefined
set setter undefined
enumerableconfigurable null [[Prototype]] [[Prototype]]
JavaScript Date
Array.prototype indexOf() push()
Int8ArrayFloat32Array ArrayBuffer DataView
Map Set < WeakMap
DOM data-* Map WeakMap
WeakMap WeakSet symbol
JSONJavaScript Object Notation JavaScriptJSON JSON
JavaScript JavaScript JavaScript
[Symbol.toPrimitive]() default hint valueOf() toString() toString() valueOf() number
[Symbol.toPrimitive]() TypeError valueOf() toString() TypeError
console.log({} + []); // "[object Object]"
{} [] [Symbol.toPrimitive]() {} [] Object.prototype.valueOf valueOf() toString() {}.toString() "[object Object]" [].toString() """[object Object]"
[Symbol.toPrimitive]() number valueOf() [Symbol.toPrimitive]() Date Symbol [Symbol.toPrimitive]() Date.prototype[Symbol.toPrimitive]() "string" "default" hint Symbol.prototype[Symbol.toPrimitive]() hint symbol
Number BigIntJavaScript number BigInt Array.prototype.slice() number number BigInt
number BigInt TypeError number BigInt number
[Symbol.toPrimitive]("default") valueOf() toString()[Symbol.toPrimitive]("number") valueOf() toString()[Symbol.toPrimitive]("string") toString() valueOf()[Symbol.toPrimitive]() valueOf toString
| Web Proxy Viewer | New URL | Original Page |