Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

how to remove property from object javascript

let myObject = {
  "ircEvent": "PRIVMSG",
  "method": "newURI",
  "regex": "^http://.*"
};

const {regex, ...newObj} = myObject;

console.log(newObj);   // has no 'regex' key
console.log(myObject); // remains unchanged
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #remove #property #object #javascript
ADD COMMENT
Topic
Name
2+5 =