You could loop through the elements and count them like this.

var hashLength = function(hash) {
    var count = 0;
    for (var i in hash) count++;
    return count;
};

--
Brandon Aaron

On 1/30/07, Nate Cavanaugh <[EMAIL PROTECTED]> wrote:
>
> Hi All,
> is there a native, or jQuery way to check the size/length of a hash object?
>
> For instance to check the length of an array, you would do something like:
> var x = [1,2];
> x.length; // is 2
>
> But how would I check this:
>
> var x = {n:2,m:4};
>
> Thanks in advance :)
> --
> View this message in context: 
> http://www.nabble.com/Checking-length-size-of-hash-object-tf3144960.html#a8718115
> Sent from the JQuery mailing list archive at Nabble.com.
>
>
> _______________________________________________
> jQuery mailing list
> discuss@jquery.com
> http://jquery.com/discuss/
>

_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

Reply via email to