Here is my object literal:
var obj = {key1: value1, key2: value2};
How can I add field key3 with value3 to the ob
key3
value3
Best way to achieve same is stated below:
function getKey(key) { return `${key}`; } var obj = {key1: "value1", key2: "value2", [getKey('key3')]: "value3"}; //console.log(obj);