Created
August 3, 2014 00:44
-
-
Save mannuelf/6c12b83547acefae3c4a to your computer and use it in GitHub Desktop.
hasOwnPoperty
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
var suitcase = { | |
shirt: "Hawaiian" | |
}; | |
if(suitcase.hasOwnProperty("shorts")){ | |
console.log(suitcase.shorts); | |
} | |
else { | |
suitcase.shorts = "Denim"; | |
console.log(suitcase.shorts); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment