Javascript data types (reference types and primitive types)

1.ECMAScript3 defined variables can be divided into the original value and the reference value.

Original value: simple data segment is stored in the stack (stack) is; that is to say their value is stored in the variable location directly accessible.

Reference values: the object is stored in the heap (heap), that is, the value stored in the variable is a pointer (Point), the pointer address -> memory object pointer to the storage place.

Analyzing the data type typeof variable; such as:

"use strict";
var a=3;

alert(typeof a);//输出 number

JavaScript basic types of 5 (primitives) simple data:

Undefined,Boolean,String,Null,Number

Object type and a complex type (reference type) that white is the C language structure; that is, after the object is instantiated in the heap memory.

For alert (typeof null); return object reference type; it is considered a null object placeholders.

Note: typeof is an operator; instead of the function.

Guess you like

Origin www.cnblogs.com/wanglijun/p/10956776.html