undefined in IE5

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Andrew Poulos

    #1

    undefined in IE5

    I'm using code that has statements similar to this:

    if (foo == undefined)

    and IE 5 complains that 'undefined' is undefined. What would the
    equivalent in IE 5 be? Is 'undefined' the similar enough to 'null' for
    me to use 'null' instead?

    Andrew Poulos
  • Ivo

    #2
    Re: undefined in IE5

    "Andrew Poulos" wrote[color=blue]
    > if (foo == undefined)[/color]

    Make that:

    if( typeof foo === 'undefined' ) {
    }

    Other types are 'string', 'object' and 'function'.
    See for example (watch for wrap)
    <URL:

    ml#typeof >

    a number returns 'number';
    a string returns 'string';
    the keyword true returns 'boolean';
    the keyword null returns 'object';
    methods, functions and predefined objects return 'function';
    a variable returns the type of the data assigned to it;
    a property returns the type of its value;



    --
    Ivo








    Comment

    Working...