<p>Given an object:</p>
<pre><code>let myObject = {
  &quot;ircEvent&quot;: &quot;PRIVMSG&quot;,
  &quot;method&quot;: &quot;newURI&quot;,
  &quot;regex&quot;: &quot;^http://.*&quot;
};
</code></pre>
<p>How do I remove the property <code>regex</code> to end up with the following <code>myObject</code>?</p>
<pre><code>let myObject = {
  &quot;ircEvent&quot;: &quot;PRIVMSG&quot;,
  &quot;method&quot;: &quot;newURI&quot;
};
</code></pre>

To remove a property from an object (mutating the object), you can do it like this:
```
```
delete myObject.regex;
// or,
delete myObject['regex'];
// or,
var prop = "regex";
delete myObject[prop];
```
```
Demo
```
```
var myObject = {
    "ircEvent": "PRIVMSG",
    "method": "newURI",
    "regex": "^http://.*"
};
delete myObject.regex;

console.log(myObject);
```
```
For anyone interested in reading more about it, Stack Overflow user
kangax
has written an incredibly in-depth blog post about the
```
delete
```
statement on their blog,
Understanding delete
. It is highly recommended.
If you'd like a
new
object with all the keys of the original except some, you could use
destructuring
.
Demo
```
```
let myObject = {
  "ircEvent": "PRIVMSG",
  "method": "newURI",
  "regex": "^http://.*"
};

// assign the key regex to the variable _ indicating it will be unused
const {regex: _, ...newObj} = myObject;

console.log(newObj);   // has no 'regex' key
console.log(myObject); // remains unchanged
```
```