json - Remove properties from objects (JavaScript) - Stack Overflow

PHOTO EMBED

Mon Nov 01 2021 18:19:52 GMT+0000 (UTC)

Saved by @arielvol #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
content_copyCOPY

https://stackoverflow.com/questions/208105/remove-properties-from-objects-javascript