how to remove a property from an object in javascript

JavaScript
var string = "Hello World";
var substring = "Hello";
if (string.indexOf(substring) != -1) {
  //Code here
} var person = {
        name: "Harry",
        age: 16,
        gender: "Male"
    };
    
    // Deleting a property completely
    delete person.age;
    alert(person.age); // Outputs: undefined
    console.log(person); // Prints: {name: "Harry", gender: "Male"}
Source

Also in JavaScript: