Site icon DexBlog.NET

An alternative to foreach on Javascript

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!!!!

Exit mobile version