Last active
April 4, 2024 22:05
-
-
Save lambdamusic/4734294 to your computer and use it in GitHub Desktop.
JavaScript: Check if array is empty in javascript #js
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