undefined in IE5

A

Andrew Poulos

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
 
I

Ivo

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;
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

How to remove the undefined thing? 1
Undefined variable error in array 3
Filename undefined for Blob ? 1
Use of undefined constant error 2
style.cursor in IE5 3
Undefined 16
event handlers in IE5 4
'push' in IE5 4

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,023
Latest member
websitedesig25

Latest Threads

Top