I find it really frustrating that the native Javascript forEach does not iterate through objects.
The underscore each does, and I haven't used it, but apparently the jQuery each also does.
So what's a guy to do if you're too lazy to implement the underscore library.
Well, I suppose this will work for an object named obj:
Object.keys(obj).forEach(function(item){
console.log(obj[item]);
})
I'll probably update this in the future when I am smarter.
No comments:
Post a Comment