Posted By

magicrebirth on 12/22/09


Tagged

array


Versions (?)

Check if array is empty in javascript


 / Published in: JavaScript
 

  1. if (testarray.length <1) alert("array is empty");
  2.  
  3.  
  4. //or
  5.  
  6. if(A && A.length==0)
  7.  
  8. //or if you have other objects that A may be:
  9.  
  10. if(A && A.constructor==Array && A.length==0)

Report this snippet  

You need to login to post a comment.