Someone with experience should be able to understand the error with ease, but for me it is hard, I tried learning online about map and for loop but no luck understanding the error, can someone please help me.
let jsonVal = [["ID","Name","Age"],["212","David","38"],["213","Mike","42"]]
let newJsonVal = []
for (let i =1; i< jsonVal.length-1; i++) {
let newObject ={}
jsonVal[i].map((d,j) => {
newObject[jsonVal[0][j] = d]
})
newJsonVal.push(newObject);
console.log(newJsonVal);
}
The output should look something like this: {"ID":"212","Name":"David","Age":38},{"ID":"213","Name":"Mike",Age"42"}
Thanks for your help in advance
newObject[jsonVal[0][j] = d]
is not valid. – skyline3000