Thursday, August 8, 2019

Iterating a JavaScript object's properties using jQuery



Is there a jQuery way to perform iteration over an object's members, such as in:



    for (var member in obj) {
...
}


I just don't like this for sticking out from amongst my lovely jQuery notation!



Answer



$.each( { name: "John", lang: "JS" }, function(i, n){
alert( "Name: " + i + ", Value: " + n );
});


each


No comments:

Post a Comment

hard drive - Leaving bad sectors in unformatted partition?

Laptop was acting really weird, and copy and seek times were really slow, so I decided to scan the hard drive surface. I have a couple hundr...