[thelist] [javascript] for ... in - prevent certain properties from showing up

Ben Taber ben.taber at gmail.com
Fri Nov 19 10:47:33 CST 2004


Thanks for the suggestion, but I'm trying to get away from looping
through the array just to get the count.  I have a feeling there's not
really a clean way to do this.


On Fri, 19 Nov 2004 10:07:17 +0000, apathetic <apatheticgenius at gmail.com> wrote:
> Instead of using the associativeArray object detailed in your post,
> how about using something like:
> 
> function countObject( obj ) {
>     var len = 0;
>     for( var val in obj ) {
>         len++;
>     }
>     return len;
> }
> 
> --
> http://www.apatheticgenius.com/
> 
> http://elaborate.sourceforge.net/ - PHP/MySQL wiki engine
> http://www.hyperlinkage.com/ - Online RSS reader
>


More information about the thelist mailing list