Skip to content

Instantly share code, notes, and snippets.

@UltCombo
Last active December 16, 2015 08:49
Show Gist options
  • Save UltCombo/5408691 to your computer and use it in GitHub Desktop.
Save UltCombo/5408691 to your computer and use it in GitHub Desktop.
//para testar se nosso objeto jQuery possui elementos:
if ($el.length) {/*...*/}
//isto é equivalente à:
if ($el.length !== 0) {/*...*/}
//Já que .length sempre é um número >= 0, também podemos escrever:
if ($el.length > 0) {/*...*/}
//e para ver se não possui nenhum elemento:
if (!$el.length) {/*...*/}
//isto equivale à:
if ($el.length === 0) {/*...*/}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment