Skip to content

Instantly share code, notes, and snippets.

@criso
Created November 16, 2012 15:13
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
checking existence of props
var props = {
foo: true,
bar: 1,
baz: false
};
if (props.baz) {
console.log("Won't work")
}
if ("baz" in props) {
console.log("WORKS");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment