JavaScript data type (a)

JavaScript data type of the undefined and null


typeof


Features

Detection variable type

grammar

typeof variable or typeof (variable)

return value

string type, there may be a string, number, boolean, object, undefined, function



undefined

Only one type undefined value, i.e. special undefined

Explanation

In general, there is no need to explicitly set the variable to a worthy case undefined



null

  1. A null value indicates a null object pointer
  2. If you define a variable to hold the object to prepare in the future, it is best to change the amount is initialized to null value and not the other

Explanation

undefined values ​​are derived from the null value, it returns undefined == null result is true

Published 15 original articles · won praise 16 · views 219

Guess you like

Origin blog.csdn.net/qq_43133192/article/details/104886694