Created
March 14, 2012 12:09
-
-
Save sebarmeli/2036058 to your computer and use it in GitHub Desktop.
Delete in JS
This file contains 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
(function(){ | |
var a = 5; | |
delete a; // false | |
console.log(a); //prints 5 | |
var obj = { | |
prop1 : "name1" | |
} | |
delete obj.prop1; //true | |
console.log(obj.prop1); // prints "undefined" | |
}()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment