Forum Moderators: open

Message Too Old, No Replies

instanceof Array

         

webaster

9:17 pm on Jul 21, 2005 (gmt 0)

10+ Year Member



This line throws an error in IE5 MAC.

if (tag instanceof Array). This operator is not implemented in IE 5 MAC

to avoid errors in IE5 MAC - any alternative?

Bernard Marx

12:50 pm on Jul 22, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Usethe constructor property all-round:

if( obj.constructor == Array )

webaster

2:07 pm on Jul 22, 2005 (gmt 0)

10+ Year Member



if (typeof(handler) == 'array') {
// do something

}

This is an other option?

webaster

2:15 pm on Jul 22, 2005 (gmt 0)

10+ Year Member



if (typeof TreeWalker!== String(undefined) && collection instanceof TreeWalker) {

anyway to replace instanceof here with other operator