View Single Post
Old 04-25-2009, 06:12 PM   #19 (permalink)
Kalle
The Frequenter
Zend Certified 
 
Join Date: Sep 2007
Location: Denmark
Posts: 352
Thanks: 8
Kalle is on a distinguished road
Default

Quote:
Originally Posted by allworknoplay View Post
Yeah you threw a new one at me...


Code:
"for(y in x)"


I will go ahead and read up on Mootools....I'll go with your suggestion and hope in the process the fundamentals of JS don't escape me...
This one is similar to foreach, except its written the other way around:

javascript Code:
for(c in ['Hello', 'World'])
{
    alert(c);
}

Arrays or objects to iterate are set on the right side, unlike foreach in PHP where its on the left side. The following example would looks like this in php:
PHP Code:
foreach(Array('Hello''World') as $c)
{
    echo(
$c);

__________________
Send a message via MSN to Kalle Send a message via Skype™ to Kalle
Kalle is offline  
Reply With Quote