There are several types of primitive js? js basic data types and reference types What is the difference in storage? null is object?

first question: 

   There are six types of raw js, before there are five, now more Symbol ,

  1. number (integer, float int / float)

  2. string string

  3.bollean Boolean (true false)

  4.null (null)

  5.undefined (null, no, do not exist)

  6.symbol

  Extend it, the difference between null and undefined?

  null denotes a null object pointer, a variable is assigned to be an object, but has no value at this time may be assigned null

  

1 var a = null
2 console.log(a) // null

 

  undefined variables have been declared, but not initialized, (indicating that the variable is defined, but no assignment)

1 var b;
2 console.log(b) // undefined

second question:

  1. The  basic data types of storage

    In  the form stored in stack, with the assignment to the data itself is stored,  a type of determines the type of storage space is fixed.

 

1 var c = 4
2 console.log(c) // 4
3 var c = 5
4 console.log(c) // 5

 

 

 

   2. The reference type Object

    In heap stored, stored in the assignment of a pointer to an object, with the instance of the type is determined, the storage space is not fixed

 

var d = {}
d.a = '123'
d.b = '234'
console.log(d) // {a: '123', b: '234'}

 

The third question: null is object?

  Express my own point of view, null is not an object, he was just an empty object pointer, null instance of object ===> false

 

Guess you like

Origin www.cnblogs.com/0915ty/p/10937937.html