How do I remove a property from a JavaScript object?
Asked 07 September, 2021
Viewed 875 times
  • 49
Votes

Say I create an object as follows:

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

How should I remove the property regex to end up with new myObject as follows?

let myObject = {
  "ircEvent": "PRIVMSG",
  "method": "newURI"
};

30 Answer