Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* create global property via variable declaration; property has DontDelete */
- var num = 1;
- /* create global property via undeclared assignment; property has no DontDelete */
- prop = 2;
- delete num; // false
- typeof num; // "number"
- typeof prop; // "number"
- delete prop; // true
- typeof prop; // "undefined"
- /* `func` is created as a property with DontDelete */
- function func(){}
- /* Later assignments do not modify attributes. DontDelete is still there! */
- func = 1;
- delete func; // false
- typeof func; // "number"
- /* But assigning to a property that doesn't exist,
- creates that property with empty attributes (and so without DontDelete) */
- this.bar = 1;
- delete bar; // true
- typeof bar; // "undefined"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement