[ Web Proxy ]
URL:
Viewing: https://developer.mozilla.org/ja/docs/Web/JavaScript/Guide/Data_structures [Back]  [Original]

JavaScript - JavaScript | MDN

MDN Web Docs

View in English Always switch to English

JavaScript

JavaScript

JavaScript JavaScript

js
let foo = 42; // foo 
foo = "bar"; // foo 
foo = true; // foo 

JavaScript

js
const foo = 42; // foo 
const result = foo + "1"; // JavaScript foo 
console.log(result); // 421

JavaScript

null typeof typeof null "object" null === null

null undefined Number toExponential() JavaScript null undefined TypeError

typeof
Null "object"
Undefined "undefined"
"boolean" Boolean
"number" Number
"bigint" BigInt
"string" String
"symbol" Symbol

Null

Null null 1

Undefined

Undefined undefined 1

undefined null typeof null === "object" undefined

null Object.getPrototypeOf()Object.create() undefined null

null undefined undefined

(Boolean) true false 2

if...elsewhile

(Number) IEEE 754 2-1074 (Number.MIN_VALUE) 21023 (2 - 2-52) (Number.MAX_VALUE) -(253 1) (Number.MIN_SAFE_INTEGER) 253 1 (Number.MAX_SAFE_INTEGER) JavaScript Number.isSafeInteger()

Infinity -Infinity Number.POSITIVE_INFINITY Number.NEGATIVE_INFINITY

10 -0 +0 0 +0 +0 === -0 true

js
console.log(42 / +0); // Infinity
console.log(42 / -0); // -Infinity

NaN ("Nnot a Number") JavaScript

`JavaScript 32

: 1 JavaScript

(BigInt) JavaScript (Number.MAX_SAFE_INTEGER)

n BigInt()

Number.MAX_SAFE_INTEGER

js
// 
const x = BigInt(Number.MAX_SAFE_INTEGER); // 9007199254740991n
x + 1n === x + 2n; // false9007199254740992n  9007199254740993n 

// 
Number.MAX_SAFE_INTEGER + 1 === Number.MAX_SAFE_INTEGER + 2; // true 9007199254740992

+, *, -, **, % >>>

TypeError

(String) UTF-16 16 0 1 length UTF-16 Unicode String

JavaScript

JavaScript

(Symbol)

JavaScript callable

JavaScript

2 JavaScript Object.defineProperty() Object.getOwnPropertyDescriptor() Object.defineProperty()

value

get JavaScript

writable

enumerable

for...in

configurable

1 2 (get set)

: JavaScript

get

undefined

set

undefined

enumerable

for...in

configurable

null [[Prototype]] [[Prototype]]

Map Map

JavaScript API 2 Date Temporal Date

:

length

Array.prototype indexOf() () push() ()

Int8ArrayFloat32Array ArrayBuffer DataView

: Map, Set, WeakMap, WeakSet

Set WeakSet Map WeakMap

Map Set < "less than" WeakMap

DOM data-* Map WeakMap

WeakMap WeakSet

: JSON

JSON (JavaScript Object Notation) JavaScript JSON JSON

JavaScript

JavaScript JavaScript

[Symbol.toPrimitive]() "default" valueOf()toString() toString() valueOf()

[Symbol.toPrimitive]() TypeError valueOf() toString() TypeError

js
console.log({} + []); // "[object Object]"

{} [] [Symbol.toPrimitive]() {} [] valueOf() Object.prototype.valueOf toString() {}.toString() "[object Object]" [].toString() "" "[object Object]"

[Symbol.toPrimitive]() valueOf() [Symbol.toPrimitive]() Date Symbol [Symbol.toPrimitive]() Date.prototype[Symbol.toPrimitive]() "default" "string" Symbol. prototype[Symbol.toPrimitive]()

2 Array.prototype.slice()

TypeError

NullUndefined

3

  • : [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