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 2 of 2
  1. #1
    New Coder
    Join Date
    Aug 2006
    Posts
    26
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Getting a property's value

    Hi, I was wondering if I could get a property's value within a code like this:
    Code:
            for (property in object)
            {
                if (property == 'src')
                {
                    // get the value here
                }
            }
    Thanks

  • #2
    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
    In Javascript, someObject.property is equivalent in every way to someObject["property"]. Thus you can access the value in your particular case as object[property].


  •  

    Posting Permissions

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