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 { [propertyName]: _, ...result } = obj
  return result
}
console.log(removeProperty(obj, 'foo'));
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #remove #object #spread #operator
ADD COMMENT
Topic
Name
6+3 =