0
var myObject = {
    key1: "value1",
    key2: "value2",
};

function addToMyObject(item) {
    myObject.item;
    console.log(item + " has been added to your object.");
    console.log(myObject);
}

addToMyObject(key3 = "value3");

I understand I could convert my object to an array, but could I do this to an object?

Barmar
  • 741,623
  • 53
  • 500
  • 612
Nic T.
  • 11
  • 3

0 Answers0