< JavaScript < Reserved words

The typeof keyword

The typeof keyword is a unary operator that returns a string giving the type of the parametre.

Syntax

  typeof[(]expression[)];

The operator returns six values, which are boolean, function, number, object, string, and undefined.

Examples

  theArray = new Array();
  if (typeof(theArray) == 'object') {
    []
  }
This article is issued from Wikibooks. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.