Skip to content

Instantly share code, notes, and snippets.

@guyellis
Created April 20, 2015 20:39
Show Gist options
  • Save guyellis/3498ab1fb55ad0f3caa0 to your computer and use it in GitHub Desktop.
Save guyellis/3498ab1fb55ad0f3caa0 to your computer and use it in GitHub Desktop.
How type inferencing can catch errors
var obj = {
one: 'one',
two: 'two'
};
// Forgot to add length after Object.keys(obj)
var isBig = Object.keys(obj) > 1;
console.log(isBig);
// false but should be true.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment