Recently I was working on a use case where I had an Object like below let obj1 = {name: "Dr Strange",stone: "Time",status: "alive"} Here, the API was designed in a way that we needed to send only when was . Also for some reason I was given the input object in the above format. stone status Time I wanted to edit above object and just remove property entirely if . So what I use to do was stone status !== 'active' //incorrect wayif(obj1.status !== 'active')obj1.stone= undefined; One of my friend told me this seemed wrong as I was trying to delete the property by setting it to . So I asked for the right way, but he couldn’t think of the other way which would do this in a better way. I used this way and moved ahead at that time. undefined Recently, I came across keyword in JavaScript which I had not known before. I also realized that when we set any property to , we don’t actually delete the property. delete undefined Here’s . Now when we console.log the above object an example to prove that console.log(obj1) // {name: "Vision", stone: "Time", alive: undefined} So the property is is undefined but it still present in an object. So the right way of doing this: alive let obj1 = {name: "Dr Strange",stone: "Time",alive: true}delete obj1.alive;obj1 // {name: "Vision", stone: "Soul"} So now the property is deleted from the object completely instead of having with value of . This not only removes the property from object but also saves memory by deleting its reference. undefined But don’t worry about Dr Strange he is hiding somewhere in the past, so might as well come to save Avengers in End Game.