how to remove a property from an object in javascript how to remove elements from object in typescript

The solution for “how to remove a property from an object in javascript how to remove elements from object in typescript” can be found here. The following code will assist you in solving the problem.

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”}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”}

Thank you for using DeclareCode; We hope you were able to resolve the issue.

More questions on [categories-list]

0
inline scripts encapsulated in