I'm not sure what I am doing wrong in this. When I try to run the code, it says that there is an undefined here:
obj[array[i]array[j][0]] = obj[array[i]array[j][1]];
Can someone explain what I am doing incorrect? I am looking for to produce an object return that looks like
obj = {
firstName:'Joe'
}
var array = [
[
['firstName', 'Joe'], ['lastName', 'Blow'], ['age', 42], ['role', 'clerk']
],
[
['firstName', 'Mary'], ['lastName', 'Jenkins'], ['age', 36], ['role', 'manager']
]
]
function transformEmployeeData(array){
var obj = {};
for(var i = 0; i < array.length; i++){
for(var j = 0; j < array[i].length; j++){
obj[array[i]array[j][0]] = obj[array[i]array[j][1]];
}
}
return obj;
}
transformEmployeeData(array);