<!DOCTYPE html>
<html lang="en-US">
<body>
<h1>JSON Deleting a Key from the object</h1>
<button onclick="myFunction()">Click Me</button>
<script>
var data = [
{
"name": "Mike",
"age": 36,
"married": true,
"partner": "Jade"
}
]
function myFunction(){
// Deleting a key (married) from the first object by using dot notation.
delete data[0].married;
// Deleting a key (partner) from the first object by using bracket notation.
delete data[0]["partner"];
console.log(data);
}
</script>
<p><strong>Note</strong>: Click on the button and check your console</p> </body>
</html>