Isn't tan issue with Array.forEach() that you can't use 'break' to stop the loop?
-Alex On 5/8/16, 3:41 AM, "Harbs" <harbs.li...@gmail.com> wrote: >So would this be a workable solution? > >This: > >for each(item in object){ > item.doSomething(); >} > >Would become: > >if (!!object.forEach){ > object.forEach(function(item){ > item.doSomething(); > }); >} else { > var foreachiter0_target = object; > for (var foreachiter0 in foreachiter0_target) > { > var item = foreachiter0_target[foreachiter0]; > item.doSomething(); > } >} > >I could add a forEach method to XMLList objects and then we would not >need to do compile time checks for XML. (at least for cases of for each) > >On May 8, 2016, at 3:16 AM, Josh Tynjala <joshtynj...@gmail.com> wrote: > >> The array forEach() seems like an acceptable alternative. Looking at MDN >> [1], forEach is widely supported in browsers. Including IE 9. >> >> >>https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_ >>Objects/Array/forEach >> >> - Josh >> >> On Sat, May 7, 2016 at 4:32 PM, lizhi <s...@qq.com> wrote: >> >>> 10x slow. >>> maybe use the arr.forEach. >>> pls run this code >>> >>> https://gist.github.com/matrix3d/a9765b94ade3d626ad64d16f28deccae >>> >>> >>> >>> -- >>> View this message in context: >>> >>>http://apache-flex-development.2333347.n4.nabble.com/flexjs-foreach-very >>>-slow-tp52571p52880.html >>> Sent from the Apache Flex Development mailing list archive at >>>Nabble.com. >>> >