Created
December 11, 2011 14:52
-
-
Save niyazpk/1460963 to your computer and use it in GitHub Desktop.
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
// An easy fix would be: | |
for (name in object){ | |
if (object.hasOwnProperty(name)){ | |
// do stuff | |
} | |
} | |
// The above will fail if the object has a hasOwnProperty property. | |
// To Fix that, we write: | |
for (name in object){ | |
if (object.prototype.hasOwnProperty.call(object, name)){ | |
// do stuff | |
} | |
} | |
// aweful |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment