I need to fill and object with a for, but I don't know if it's possible. The code that I've tried is this:
let objecte = {
0: "a",
1: "b",
2: "c",
};
let prop = Object.keys(objecte);
let valor = Object.values(objecte);
function changePropValues(obj, prop, value){
let newObj = {};
for(let i=0;i<Object.keys(obj).length;i++){
newObj = {
valor[i]: prop[i],
};
}
return newObj;
};
console.log(changePropValues(objecte,prop,valor
But I've this error: Uncaught SyntaxError: missing : after property id
It's possible fill an object with a for?