View Full Version : in operator

01-16-2003, 04:25 PM
In NN6 and IE5.5 we saw the introduction of the in operator. This operator allows a script statement to inspect an object to see if it has a named property or method.

I would like to know if anyone has come accross a script that can accomplish the same without the use of the in operator so that it can be used with older browsers. My target browser in this case is IE5.0.

Thanks in advance!


01-17-2003, 03:24 AM
Hi Juan,

To my knowledge, the in operator was introduced in the first
version of JScript so it should be supported by all IE versions.

( ) ( )

01-17-2003, 05:06 AM
yes, in my javascript book (old) it has the in operator. like the for(object in property), i think that is the syntax. i think it is only allowed in for loops like i have above.

01-17-2003, 05:15 AM
While for...in has been around for a while, I believe jromero was talking about:

if ('propname' in object) {

Which I believe has the compatibility restrictions he pointed out.