mozilla

Revision 70206 of forEach

  • Revision slug: Talk:JavaScript/Reference/Global_Objects/Array/forEach
  • Revision title: forEach
  • Revision id: 70206
  • Created:
  • Creator: Porfirio
  • Is current revision? No
  • Comment

Revision Content

Is this a from _core_ of JavaScript 1.5? If so, is JS 1.5 Gecko only? Those extra features like forEach are Gecko only, and it should be mentioned that they should *_not_* be used on web pages. --Gandalf 07:18, 31 May 2005 (PDT)

Is there a way to make forEach make use of break? [1,2,3].forEach(function(value, index, array){ print(value); //break? if (value>1){ return false;//we could have some way to break when we return false } }); //woulld print 1 2 --Porfirio 11:17, 22-06-2008

Revision Source

<p>Is this a from _core_ of JavaScript 1.5? If so, is JS 1.5 Gecko only?
Those extra features like forEach are Gecko only, and it should be mentioned that they should *_not_* be used on web pages.
--<a href="User:Gandalf">Gandalf</a> 07:18, 31 May 2005 (PDT)
</p><p>Is there a way to make forEach make use of break?
<span class="plain">
[1,2,3].forEach(function(value, index, array){
  print(value);
  //break?
  if (value&gt;1){
    return false;//we could have some way to break when we return false
  }
});
//woulld print 1 2
</span>
--<a href="User:Porfirio">Porfirio</a> 11:17, 22-06-2008
</p>
Revert to this revision