Here is the code snippet I am working with:
for (var i = 0; i<ke.length; i++)
{
var ar = ke[i];
var temp = {ar :(n[a])}; //how to resolve a
console.log(temp);
}
The 'temp' object is supposed to contain a list of column names(key) and values, but it is taking 'a' as a literal. How can I fix this? The 'n[a]' represents a JSON object where 'a' is the column name.
Current output: temp = {a:["some", "value"] }
Desired output: {"valueOfA" : ["some", "value"] }
I come from a Java background, so JavaScript seems unfamiliar to me. Any help would be greatly appreciated. Thank you in advance.