Update:

You could remove a property from an object with a tricky Destructuring assignment:

const doSomething = (obj, prop) => {
  let {[prop]: omit, ...res} = obj
  return res
}

Though, if property name you want to remove is static, then you could remove it with a simple one-liner:

let {lastname, ...o2} = o

The easiest way is simply to Or you could clone your object before mutating it:

const doSomething = (obj, prop) => {
  let res = Object.assign({}, obj)
  delete res[prop]
  return res
}

Alternatively you could use omit function from lodash utility library:

let o2 = _.omit(o, 'lastname')

It's available as a part of lodash package, or as a standalone lodash.omit package.

Answer from Leonid Beschastny on Stack Overflow
🌐
GitHub
gist.github.com › CoralSilver › 54265046f317a467686e6294034fc8b3
Remove key from object with ES6 destructing · GitHub
Remove key from object with ES6 destructing · Raw · removeKey.js · This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
🌐
GeeksforGeeks
geeksforgeeks.org › javascript › how-to-remove-a-key-from-javascript-object
How to remove a key-value pair from JavaScript object? - GeeksforGeeks
The delete operator removes a specified key-value pair from a JavaScript object. It directly deletes the property and its value from the object, modifying the original object.
Published: July 23, 2025
🌐
W3Resource
w3resource.com › javascript-exercises › fundamental › javascript-fundamental-exercise-39.php
JavaScript fundamental (ES6 Syntax): Remove the key-value pairs corresponding to the given keys from an object - w3resource
Use Object.keys(), Array.prototype.filter() and Array.prototype.includes() to remove the provided keys. Use Array.prototype.reduce() to convert the filtered keys back to an object with the corresponding key-value pairs.
Top answer
1 of 16
10002

To remove a property from an object (mutating the object), you can do it by using the delete keyword, 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);
Run code snippetEdit code snippet Hide Results Copy to answer Expand

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
Run code snippetEdit code snippet Hide Results Copy to answer Expand

2 of 16
1130

Objects in JavaScript can be thought of as maps between keys and values. The delete operator is used to remove these keys, more commonly known as object properties, one at a time.

var obj = {
  myProperty: 1    
}
console.log(obj.hasOwnProperty('myProperty')) // true
delete obj.myProperty
console.log(obj.hasOwnProperty('myProperty')) // false
Run code snippetEdit code snippet Hide Results Copy to answer Expand

The delete operator does not directly free memory, and it differs from simply assigning the value of null or undefined to a property, in that the property itself is removed from the object. Note that if the value of a deleted property was a reference type (an object), and another part of your program still holds a reference to that object, then that object will, of course, not be garbage collected until all references to it have disappeared.

delete will only work on properties whose descriptor marks them as configurable.

🌐
Stack Abuse
stackabuse.com › javascript-remove-a-property-from-an-object
JavaScript: Remove a Property from an Object
August 25, 2021 - For example, let's remove all properties that have a numeric value: const developer = { name : "Fred", dailyCoffeIntake : 2, favoriteLanguage : "Haskell", age : 27 }; const keysToKeep = Object.keys(developer).filter( (key)=> { return !Number.isInteger(developer[key]) }); const newDeveloper = {}; keysToKeep.forEach((key)=>{ newDeveloper[key] = developer[key] }); console.log(newDeveloper); // {name: "Fred", favoriteLanguage: "Haskell"}
🌐
Scaler
scaler.com › home › topics › how to remove a property from a javascript object?
How to Remove a Property from a JavaScript Object - Scaler Topics
January 6, 2024 - At last, I would like to add that it does not matter whether you use the delete operator or Reflect.deleteProperty() method as both of them do the task in almost same time compexity. But using Object Destructuring consumes more time comparatively. Hence, the delete operator is the most preferred ...
🌐
Flavio Copes
flaviocopes.com › home › javascript › how to remove a property from a javascript object
How to remove a property from a JavaScript object
May 22, 2018 - That is what you want for state you should not mutate, like in React or Redux code. More on properties in JavaScript Object Properties. ... const car = { color: 'blue', brand: 'Ford' } const prop = 'color' const newCar = Object.keys(car).reduce((object, key) => { if (key !== prop) { object[key] = car[key] } return object }, {})
Find elsewhere
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Operators › delete
delete - JavaScript - MDN Web Docs - Mozilla
The delete operator removes a property from an object. If the property's value is an object and there are no more references to the object, the object held by that property is eventually released automatically.
🌐
JanBask Training
janbasktraining.com › community › java › how-do-i-remove-a-key-from-a-javascript-object
How do I remove a key from a JavaScript object? | JanBask Training Community
September 21, 2025 - JavaScript provides multiple ways to achieve this, each with slightly different use cases and behaviors. The most straightforward method is using the delete operator. For example: let user = { name: "Alex", age: 25, city: "New York" }; delete ...
🌐
GeeksforGeeks
geeksforgeeks.org › javascript › how-to-remove-an-entry-by-key-in-javascript-object
Remove an Entry by Key in a JavaScript Object - GeeksforGeeks
August 24, 2026 - The Object.keys() method returns an array containing the object's property names. The filter() method can then be used to exclude the key that should be removed.
🌐
LabEx
labex.io › tutorials › javascript-omit-object-keys-28529
Mastering Object Key Omission in JavaScript | LabEx
The Object.keys() method is used to get all the keys of the object · The Array.prototype.filter() method is then used to remove the specified keys from the list of keys
🌐
Blogger
maibushyx.blogspot.com › home › remove key from object javascript › remove key from object javascript es6 › remove key from object javascript lodash
36 Remove Key From Object Javascript - Javascript Overflow
October 20, 2021 - In this article let us see how to remove key-value pairs corresponding to a given key in the object. Using delete operator. When only a single key is to be removed we can directly use the delete operator specifying the key in an object. Second way. Reflect.deleteProperty () method is also used ...
🌐
Codez Up
codezup.com › home › 10 ways to delete / remove property of an object | javascript
How to Delete or Remove a Property From a JavaScript Object
November 8, 2021 - JavaScript objects don’t have a built-in “remove this key” button beyond the delete keyword, so most of the confusion around removing a property is really about picking the right tool for the job: do you want to mutate the object in place, or produce a new object with the property gone and the original left untouched?
🌐
Ultimate Courses
ultimatecourses.com › blog › remove-object-properties-destructuring
Removing Object Properties with Destructuring - Ultimate Courses
This new way to remove object ... well as it being an immutable operation. Before destructuring, we would typically use the delete keyword to remove properties from an object....
🌐
DEV Community
dev.to › mohsenkamrani › 6-ways-to-delete-a-property-in-javascript-you-must-know-912
6 Ways to Delete a Property In JavaScript You Must Know - DEV Community
January 12, 2023 - 3. You can also use the Object.entries() method to remove a property from an object. This method returns an array of arrays containing the key-value pairs of an object.
🌐
DhiWise
dhiwise.com › post › how-to-use-javascript-unset-object-key-to-manage-objects
Using Javascript Unset Object Key to Manage Objects
November 21, 2024 - In this blog, we'll delve into the nuances of using the delete operator, its impact on object references, and best practices to ensure clean and efficient object manipulation. The delete operator is a built-in Javascript method that removes ...