Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4

Thread: in operator

  1. #1
    New to the CF scene
    Join Date
    Jan 2003
    Location
    Springfield, Massachusetts
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    in operator

    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!

    Juan

  • #2
    Owl
    Owl is offline
    New Coder
    Join Date
    Jun 2002
    Posts
    62
    Thanks
    0
    Thanked 1 Time in 1 Post
    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.

    ( •) (• )
    >>V

  • #3
    Regular Coder
    Join Date
    Sep 2002
    Location
    Louisiana
    Posts
    576
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.

  • #4
    jkd
    jkd is offline
    Senior Coder jkd's Avatar
    Join Date
    May 2002
    Location
    metro DC
    Posts
    3,163
    Thanks
    1
    Thanked 18 Times in 18 Posts
    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.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •