undefined in IE5

Discussion in 'Javascript' started by Andrew Poulos, Dec 10, 2004.

  1. 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
     
    Andrew Poulos, Dec 10, 2004
    #1
    1. Advertising

  2. Andrew Poulos

    Ivo Guest

    "Andrew Poulos" wrote
    > if (foo == undefined)


    Make that:

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

    Other types are 'string', 'object' and 'function'.
    See for example (watch for wrap)
    <URL:
    http://www.devguru.com/Technologies/ecmascript/quickref/special_operators.ht
    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
    http://4umi.com/web/links.htm
     
    Ivo, Dec 10, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Scott M.
    Replies:
    1
    Views:
    335
    ʹÃûÑï
    Nov 28, 2003
  2. Tom
    Replies:
    0
    Views:
    1,039
  3. Mantorok Redgormor
    Replies:
    70
    Views:
    1,764
    Dan Pop
    Feb 17, 2004
  4. VK
    Replies:
    45
    Views:
    607
    Dr John Stockton
    Sep 12, 2006
  5. -Lost
    Replies:
    13
    Views:
    373
    Richard Cornford
    Jan 31, 2007
Loading...

Share This Page