Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

remove a object name from spread operator

let obj = {foo: 1, bar: 2, baz: 3}
function removeProperty(obj, propertyName) {
  let newObj = {...obj};
  delete newObj[propertyName];
  return newObj;
}
console.log(removeProperty(obj, 'foo'));
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #remove #object #spread #operator
ADD COMMENT
Topic
Name
5+7 =