rubycoloredglasses


I'm Jason, a web application developer in East Tennessee.


Using 'for in' in Javascript

Today our lead front-end developer pointed out to me that when using a ‘for in’ loop in Javascript that you want to make sure to use hasOwnProperty() on the element to make sure it belongs to the object, and not properties that were inherited through the prototype chain.

More information is available on this page describing common Javascript code mistakes caught by JSLint.

comments powered by Disqus