Skip to content

Instantly share code, notes, and snippets.

@JamieDixon
Created December 4, 2019 11:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JamieDixon/a90ebb4b65e995d0079fa56b56a31a00 to your computer and use it in GitHub Desktop.
Save JamieDixon/a90ebb4b65e995d0079fa56b56a31a00 to your computer and use it in GitHub Desktop.
const hasAnyOwnProp = o => {
for(let p in o) {
return true;
}
return false
}
const a = hasAnyOwnProp({ bob: 'bob', sam: 'sam' });
const b = hasAnyOwnProp({});
console.log('a', a); // true
console.log('b', b); // false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment