So I am getting into a bit of object manipulation in JavaScript for the first time and I have a question I\'m wondering if anyone could answer.
When I have an object
Just bumped into this and found that none of the answers highlights one important difference between for-loop
and map
as to when to use one over the other:
map
you can't break out of an iteration which you can with for-loop
.For e.g, you can't do this
const arr = [5, 6, 9, 4];
arr.map(elem=>{
if(elem === 5){
break; //This is not allowed
}
})