how to remove element in object in javascript code example

Example 1: How can I remove a specific item from an array

const array = [2, 5, 9];

console.log(array);

const index = array.indexOf(5);
if (index > -1) {
  array.splice(index, 1);
}

// array = [2, 9]
console.log(array);

Example 2: javascript remove object key

var obj = {a: 5, b: 3};
delete obj["a"];
console.log(obj); // {b: 3}

Example 3: javascript remove element from object

delete object.element

Example 4: js remove key from object

// Example 1
var key = "Cow";
delete thisIsObject[key]; 

// Example 2
delete thisIsObject["Cow"];

// Example 3
delete thisIsObject.Cow;

Example 5: javascript remove object element

delete object.element;