rename property javascript 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
Example 3: javscript rename property name
a.Prop3 = a.Prop1;
delete a.Prop1;