To remove a property from a javaScript object, the code is as follows −
Example
<!DOCTYPE html>
<html>
<body>
<h1>JavaScript Object Properties Example</h1>
<h2 class="sample">athlete.name</h2>
<script>
let athlete = {
name: "James Anderson",
sport: "Cricket",
trophies: "15"
};
document.querySelector( ".sample" ).innerHTML = `${athlete.name} who plays ${athlete.sport} has ${athlete.trophies} trophies`;
delete athlete.trophies;
document.querySelector( ".sample" ).innerHTML += ` <br> ${athlete.name} who plays ${athlete.sport} has ${athlete.trophies}
trophies`;
</script>
</body>
</html>Output
The above code will produce the following output −
