Last active
February 21, 2022 22:47
-
-
Save blarfoon/f0c2b5299a419c1a80111018f2dbdd80 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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