Skip to content

Instantly share code, notes, and snippets.

@junosuarez
Created November 23, 2015 18:21
Show Gist options
  • Save junosuarez/eb710c26b6fb8adbcd54 to your computer and use it in GitHub Desktop.
Save junosuarez/eb710c26b6fb8adbcd54 to your computer and use it in GitHub Desktop.

hasOwnProperty check is not necessary.

the advice in Crockford's little javascript book only made sense in a time when it was more common place for people to do really silly things, like add enumerable properties to the global Object object, so it was necessary to be paranoid-level defensive at the expense of code readability. In our codebase, we know that these things aren't happening, so we should prefer readability.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment