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

JavaScript - JavaScript | MDN

This page was translated from English by the community. Learn more and join the MDN Web Docs community.

View in English Always switch to English

JavaScript

, . () , JavaScript, . . , .

In this article

JavaScript . , . . , :

js
var foo = 42; //  foo  Number
foo = "bar"; //   foo  String
foo = true; // foo   Boolean

ECMAScript 8 :

  • 6 :

    • Undefined ( ) : typeof instance === "undefined"
    • Boolean (, ) : typeof instance === "boolean"
    • Number () : typeof instance === "number"
    • String () : typeof instance === "string"
    • BigInt : typeof instance === "bigint"
    • Symbol ( ECMAScript 6) : typeof instance === "symbol"
  • Null (Null ) : typeof instance === "object". , ;

  • Object () : typeof instance === "object". , , , new: new Object, new Array, new Map, new Set, new WeakMap, new WeakSet, new Date ;

typeof , .. "object" , typeof , . , instanceof, , .

typeof: "object" null "function" : , , , , - , "", .

JavaScript, , ( , ). , C, , JavaScript . .

: true () false (). Boolean Boolean .

Null

: null. null Null .

Undefined

, , undefined. undefined undefined .

ECMAScript, , 64- IEEE 754. , JavaScript . , () . , : +Infinity ( ), -Infinity ( ), NaN ( ).

+/-Infinity, Number.MAX_VALUE Number.MIN_VALUE. ECMAScript 2015, , , Number.isSafeInteger(), Number.MAX_SAFE_INTEGER Number.MIN_SAFE_INTEGER. , .

JavaScript : -0 +0. (0 +0). . , +0 === -0 . , :

js
> 42 / +0
Infinity
> 42 / -0
-Infinity

, JavaScript . , , . , JavaScript (, , ). , , . , , , . , .

JavaScript String. 16- . . 0, 1, . .

C, JavaScript . , , , . . :

!

. :

, , . , , ( JavaScript ). , , . , . . , .

. .

(Symbol)

JavaScript ECMAScript 2015. , ( ). . (enum) C. Symbol Symbol.

(BigInt)

BigInt , , 2 53, , JavaScript Number .

js
> let bigInt = 19241924124n;
> console.log(bigInt);
19241924124n
> console.log(typeof bigInt);
"bigint"

, , .

JavaScript . , . , , , . , .

: - - (, ). .

-

, :

[[Value]] JavaScript , . undefined
[[Writable]] Boolean false, [[Value]] . false
[[Enumerable]] Boolean true, for...in. . false
[[Configurable]] Boolean false, , , [[Value]] [[Writable]] . false
Read-only Boolean [[Writable]] ES5.
DontEnum Boolean [[Enumerable]] ES5.
DontDelete Boolean [[Configurable]] ES5.

-

- ( ) , :

[[Get]] Function undefined , . get. undefined
[[Set]] Function undefined , , , . set. undefined
[[Enumerable]] Boolean true, for...in. false
[[Configurable]] Boolean false, , -. false

: JavaScript, ( Object.defineProperty()). .

JavaScript . ( Symbol), . -.

, .

Date.

length. , Array.prototype, . , indexOf ( ), push ( ) . . .

, . " " , Int8Array, Float32Array .. . ArrayBuffer DataView.

: Maps, Sets, WeakMaps, WeakSets

, JavaScript ECMAScript Edition 6. Set WeakSet , Map WeakMap ( ) . Map WeakMap , Map . WeakMap.

Map Set ECMAScript 5. , , . ( WeakMap) .

, DOM, , data-*. , , . Maps WeakMaps .

: JSON

JSON (JavaScript Object Notation) , JavaScript, . JSON . JSON JSON .

JavaScript . , , .

typeof

typeof . , .


Web Proxy Viewer  |  New URL  |  Original Page