Answers for "javscript rename property name"

3

renemane object key js

obj = { name: 'Bobo' } //key: value
obj.newName = obj.name // on object create new key name. Assign old value to this
delete obj.name //delete object with old key name
Posted by: Guest on July-15-2020
0

js rename property

function renameProperty(obj, oldName, newName) {
  obj[newName] = obj[oldName];
  delete obj[oldName];
}
Posted by: Guest on July-17-2020
0

js rename property

obj.newProperty = obj.property
delete obj.property
Posted by: Guest on July-17-2020
0

javscript rename property name

a.Prop3 = a.Prop1;
delete a.Prop1;
Posted by: Guest on January-13-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language