Breaking out of a PrototypeJS .each() loop

前端 未结 4 1378
难免孤独
难免孤独 2021-02-05 09:52

In this very contrived example, I have an array with 3 elements that I\'m looping over using the .each() method.

var vals = $w(\'foo bar baz\'); 

vals.each( func         


        
4条回答
  •  春和景丽
    2021-02-05 10:56

    From that page you linked to, isn't the correct way

     if(val == 'bar')
     {
        throw $break;
     }
    

    ?

提交回复
热议问题