An alternative to foreach on Javascript

0
193

I had a big problem with a javascript object of array. You sometimes need to get a object array and this doesn’t allow you to use lenght or index.

So what do you do in this case? Here is a simple version of what i did

for (var key in arrayvariable) {
    var value = arrayvariable[key];
    console.log(key, value);
}

This works great!!!!

LEAVE A REPLY

Please enter your comment!
Please enter your name here