Skip to content

Instantly share code, notes, and snippets.

@tomnagengast
Last active August 9, 2017 18:10
Show Gist options
  • Save tomnagengast/463d0220e740a704ac8f4892b14ea204 to your computer and use it in GitHub Desktop.
Save tomnagengast/463d0220e740a704ac8f4892b14ea204 to your computer and use it in GitHub Desktop.

Set a value to a variable if one doesn't exist, like this:

name = name || 'joe';

This is quite common and very helpful. Another option is to do:

name || (name = 'joe');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment