r/learnjavascript • u/tzuchinc • Sep 20 '17
Javascript Secrets: Tips and Tricks I Regularly Use
http://www.echojs.com/news/24170
0
Upvotes
2
u/6086555 Sep 20 '17
5. Use the ‘ in’ operator to check if a key exists in an object
This is a bad idea as it will also checks the prototype.
obj.hasOwnProperty("key") is a much better solution.
2
1
u/bvbrandon Sep 20 '17
I wish I could get this time back. These are not tips and tricks. These are basics of the language as well as a few bad practices.
1
4
u/elbywan Sep 20 '17
Now that is a "Secret" !