Here is my object literal:
var obj = {key1: value1, key2: value2};
How can I add field key3 with value3 to the ob
key3
value3
You can either add it this way:
arr['key3'] = value3;
or this way:
arr.key3 = value3;
The answers suggesting keying into the object with the variable key3 would only work if the value of key3 was 'key3'.
'key3'