If objects are created and placed in an array, does the array store only the properties of the objects or also their names? This may seem like a simple question, but I've been unable to find a clear answer.
var boxA = {color: "red", width: 100};
var boxB = {color: "yellow", width: 200};
var boxC = {color: "blue", width: 300};
boxArray = [boxA, boxB, boxC];
for (var i = 0; i < boxArray.length; i++) {
//****
// What should we include here to log
// boxA
// boxB
// boxC
//****
}
Adding extra steps such as
boxA.box = boxA;
and then using
console.log(boxArray[i].box);
makes it work, but is that really necessary?