Skip to content

Instantly share code, notes, and snippets.

@SeanJM
Created April 21, 2016 14:04
Show Gist options
  • Save SeanJM/dda10ad4ab9e230a3d557237203e37cd to your computer and use it in GitHub Desktop.
Save SeanJM/dda10ad4ab9e230a3d557237203e37cd to your computer and use it in GitHub Desktop.
A function to see if an object has a key
function hasKey (object, key) {
for (var k in object) {
if (k === key && object.hasOwnProperty(key)) {
return true;
}
}
return false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment