I am having more issues than what i would guess with creating an array and updating its values, i create 4 positions array, and somehow, if i try to update the 1st position the second updates two, same with 3 and 4. the values in both paris are the same and taken from a variable.
for (let index = 0; index < recursos.length; index++) {
let recurso = recursos[index];
cantidad = parseInt(recurso.cantidad);
//frm.recursosCrear(recurso);
for (let index2 = 0; index2 < cantidad; index2++) {
const copia = recurso;
frm.recursos2.push(copia);
}
}
frm.recursos2[1]["inicio"]= "9999";
console.log(frm.recursos2);
In this case frm.recursos in pos 0 and 1 both end up with an "inicio" of 9999 even when i only asked for the pos 1
recursos cointains arrays in this case 2 arrays, one that has the info "cars" and the amount of cars "2", and anotherone with "people" and the amount of people "2", the idea is that the final array has 4 positions, 2 cars and 2 persons