And variable data

First, the data: storage on behalf of certain information in memory, is essentially a string of binary digits.

  Features: transfer calculated.

Second, the memory: the memory space that can store data generated by energizing the (temporary)

  Divided into: stack memory (memory variable) and heap memory (storage objects)

  Each memory has two data: the value of the internal memory address and its own

Three variables: value consists of variable names and occupies some space in memory.

Fourth, the data type:

  The basic data types: String Number Boolean Null Underfined 

  Reference data types: Object Function Array

  

 

 V. Analyzing data type

  -typeof: return data type [String] expression, based on the data type: String, Number, Boolean, function, underfined, Object

    Note: array, null, Object Object returns are

    

  -instanceof: determining whether the variable is an instance of an object (the constructor prototypes given on whether the object's prototype chain)

  

 

Sixth, data type conversion

  1) cast

  a.toString()  String(a)

  a.parseInt()  a.parseFloat  Number(a)

  Boolean(a)

  2) automatic conversion

    2.1) When different types of data with each other operation

  

 

    2.2) the data non-boolean value of Boolean

    

 

    2.3) of a non-numeric data unary (+ - operators)

      Converts the variable to a number, if the variable can not be converted to normal numbers, converted to NAN (also digital)

   When you try to export an object or a JavaScript variable variables will automatically call the toString () method

 

Guess you like

Origin www.cnblogs.com/qqinhappyhappy/p/11587301.html
Recommended