Skip to content

Instantly share code, notes, and snippets.

@lambdamusic
Last active April 4, 2024 22:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lambdamusic/4734294 to your computer and use it in GitHub Desktop.
Save lambdamusic/4734294 to your computer and use it in GitHub Desktop.
JavaScript: Check if array is empty in javascript #js
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