Skip to content

Instantly share code, notes, and snippets.

@lambdaman2
Created October 1, 2012 12:44
Show Gist options
  • Save lambdaman2/3811454 to your computer and use it in GitHub Desktop.
Save lambdaman2/3811454 to your computer and use it in GitHub Desktop.
JavaScript: Check if array is empty in javascript
if (testarray.length <1) alert("array is empty");
//or
if(A && A.length==0)
//or if you have other objects that A may be:
if(A && A.constructor==Array && A.length==0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment