I need to temporarily track the state of 5 objects in JavaScript. Each of these objects has a GUID as its id. Because of this, I was hoping to create an array of key/value pairs that I can work with. The key of each pair would be the id of each object. The value of each pair would be a boolean value. My problem is, I am really not sure how to do this in JavaScript. Currently, I have the following:
var myKeyValuePairs;
var myObjects = getMyObjects();
for (var i=0; i<myObjects.length; i++) {
var id = myObjects[i].id;
// What do I do now?
}
How do I build an array of key/value pairs in JavaScript?