2.1.30 [ECMA-262-1999] Section 11.4.3, The typeof Operator

V0047:

The production UnaryExpression : typeof UnaryExpression is evaluated as follows:

  1. Evaluate UnaryExpression.

  2. If Type(Result(1)) is not Reference, go to step 4.

  3. If GetBase(Result(1)) is null, return "undefined".

  4. Call GetValue(Result(1)).

  5. Return a string determined by Type(Result(4)) according to the following table:

    Type

    Result

    Undefined

    "undefined"

    Null

    "object"

    Boolean

    "boolean"

    Number

    "number"

    String

    "string"

    __SafeArray__

    __"unknown"__

    __VarDate__

    __"date"__

    Object (native and doesn't implement [[Call]])

    "object"

    Object (native and implements [[Call]])

    "function"

    Object (host)

    Implementation-dependent

    JScript 5.x returns object for all host objects including those that implement [[Call]].