In Javascript, You can remove/delete key-value pairs from the Object easily.
Just use, delete keywords with object.keyname or object['keyname']. delete used for removing a object key from given objects in Javascript.
Let’s take a simple object,
let xyz = {};
xyz.first = 1;
xyz.second = 2;
xyz.third = 3;
xyz.forth = 4;
Run console.log(xyz);
Output:
{first: 1, second: 2, third: 3, forth: 4}
Now you want to remove the third key-value pair from the object,
delete xyz.third OR delete xyz['third']
Check again Output:
{first: 1, second: 2, forth: 4}
