typeof

typeof can be used to determine the type of an object, but it does not always return what you’d expect.  Below is a list of the return values for various types in javascript:

 type typeof 
object ‘object’
 function   ’function’
 array  ‘object’
 number  ‘number’
 string   ’string’
 boolean   ’boolean’
 null   ’object’
 undefined   ’undefined’

Leave a Reply