how to update an object with a function js code example Example: how to update object in javascript myObject['first name'] = 'John'; // property name with a space