change key in object code example
Example 1: js rename property
function renameProperty(obj, oldName, newName) {
obj[newName] = obj[oldName];
delete obj[oldName];
}
Example 2: js rename property
obj.newProperty = obj.property
delete obj.property