Created
December 30, 2020 15:33
-
-
Save Jagathishrex/b19516b8717953119660dfad98b62947 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
"use strict"; | |
let user = { name : "Jagathish" }; | |
Object.preventExtensions(user); | |
try { | |
Object.defineProperty(user, 'age', { | |
value: 23 | |
}); | |
} catch (e) { | |
console.log(e); | |
// expected output: TypeError:Cannot define property age, object is not extensible | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment