Ever need to iterate though all the members of an object (javascript)?

You know you have… if you are like me though, you can never remember the exact syntax. Here it is:

for (var name in object)
{
    if (object.hasOwnProperty(name))
    {
        alert(name + ': ' + object[name]);
    }
}

Leave a Reply

 

 

 

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">