Skip to content

Instantly share code, notes, and snippets.

@blarfoon
Last active February 21, 2022 22:47
Show Gist options
  • Save blarfoon/f0c2b5299a419c1a80111018f2dbdd80 to your computer and use it in GitHub Desktop.
Save blarfoon/f0c2b5299a419c1a80111018f2dbdd80 to your computer and use it in GitHub Desktop.
const myObject = {
hi: "mom",
};
console.log(myObject.hasOwnProperty("hi")); // > true
let result = Reflect.deleteProperty(myObject, "hi");
console.log(result, myObject.hasOwnProperty("hi")); // > true false
// PAY ATTENTION NOW
Object.defineProperty(myObject, "hi", {
value: "mom",
configurable: false,
});
console.log(myObject.hasOwnProperty("hi")); // > true
result = Reflect.deleteProperty(myObject, "hi");
console.log(result, myObject.hasOwnProperty("hi")); // > false true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment