Created
October 1, 2012 12:44
-
-
Save lambdaman2/3811454 to your computer and use it in GitHub Desktop.
JavaScript: Check if array is empty in javascript
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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