Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Mar 2006
    Posts
    93
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Check if array is empty

    Hi,

    how can i check if an array is initionalized like this

    Code:
    var arrayEmp=[];
    but is empty

    something like this but this doesnt work

    Code:
    if(arrayEmp="")
    {
            alert(1);
    }

  • #2
    Regular Coder
    Join Date
    Mar 2006
    Posts
    728
    Thanks
    35
    Thanked 132 Times in 123 Posts
    if(A && A.length==0)
    or if you have other objects that A may be:
    if(A && A.constructor==Array && A.length==0)


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •