I know we can create new properties in Javascript objects during runtime but could that property be assigned a value too? For example.
var value = "New value";
var table = new Object();
var newValue = table[value];
Now, I know that value table has a new property called “value”. but does that “value key contains the information as ” New Value”. So, does that mean now table object is like following:
table = {
value:"New Value";
}
You’re confusing accessing with assigning.
If you want to assign properties to an object you do so like this:
Later, when you want to retrieve that value and store it in a new variable, that’s when you do this:
Hopefully that clarifies some. Please let me know if I can expand on any part of it.