Recent Widgets


Register for DashboardWidgets

Recent Forums Posts

Partners


iCompositions

MacDesktops.net

RSS Showcase
RSS Comments
RSS Forums

This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies. Posted in: Widget Central

javascript count function

Author Message
andrethegiant



Joined: 08 May 2005
Posts: 78

Posted: Thu Jun 09, 2005 - 7:46 pm    Post subject: javascript count function Reply with quote

ok, i have a love / hate relationship with javascript. in php, you just do count(var) and you get however many var's there are. but this doesn't work with javascript, and as far as i can tell there is no count function. Maybe i'm wrong, but I looked all over the place and couldn't find anything.

Please respond if you know. I'm trying to count how many results come up from a regular expression. i've tried count.results, count(results), results.count, and others, and nothings worked. anyone know?
View user's profile Send private message Send e-mail Widgets
Chris



Joined: 27 Jan 2005
Posts: 344
Location: Durham, UK

Posted: Fri Jun 10, 2005 - 4:53 am    Post subject: Reply with quote

If you want to see how long an array is, then use ar.length. So, since the regex is returning an array of matches, then it's results.length you are looking for.
View user's profile Send private message Send e-mail Visit poster's website AIM Address Widgets
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.

 
Powered by phpBB © 2001, 2002 phpBB Group