I want to create a dictionary in JavaScript like the following:
myMappings = [
{ "Name": 10%},
{ "Phone": 10%},
{ "Addres
The main problem I see with what you have is that it's difficult to loop through, for populating a table.
Simply use an array of arrays:
var myMappings = [
["Name", "10%"], // Note the quotes around "10%"
["Phone", "10%"],
// etc..
];
... which simplifies access:
myMappings[0][0]; // column name
myMappings[0][1]; // column width
Alternatively:
var myMappings = {
names: ["Name", "Phone", etc...],
widths: ["10%", "10%", etc...]
};
And access with:
myMappings.names[0];
myMappings.widths[0];