JavaScript/Reserved words/typeof

Previous: try Reserved words Next: var

The typeof keywordEdit

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

SyntaxEdit

  typeof[(]expression[)];

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

ExamplesEdit

  theArray = new Array();
  if (typeof(theArray) == 'object') {
    []
  }
Previous: try Reserved words Next: var