How do I set a value for a property in all indexes in the list without looping?
object:
var objeto = {
nome: "",
ativo: false
}
list:
[{"nome": "Carlos","ativo":false},{"nome": "Joao","ativo":false}]
In this example, all people should have the active property changed to true.
The way it solves:
for (var i in lista) {
lista[i].ativo = true;
}
Is there any way to avoid this loop, make this change all at once? because in the actual application the object is more complex and has many records, leaving this method slow.