Last active
March 10, 2016 10:33
-
-
Save sivaprabug/189d30a1c781e2ab8b7b to your computer and use it in GitHub Desktop.
check hasOwnProperty in Javascript Class
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
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <title></title> | |
| <script> | |
| o = new Object(); | |
| o.prop = 'exists'; | |
| function changeO() { | |
| o.newprop = o.prop; | |
| delete o.prop; | |
| } | |
| console.log(o.hasOwnProperty('prop')); | |
| changeO(); | |
| console.log(o.hasOwnProperty('prop')); | |
| o.prop = 'exists'; | |
| console.log(o.hasOwnProperty('prop')); | |
| console.log(o.hasOwnProperty('toString')); | |
| console.log(o.hasOwnProperty('hasOwnProperty')); | |
| </script> | |
| </head> | |
| <body> | |
| </body> | |
| <!-- https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Object/hasOwnProperty#Syntax gsivaprabu --> | |
| </html> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment