Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <p>@tobie langel - I rewamped your code, and it seems to work fine now.<br />
- @dean - I'm using this approach instead of yours. As I tested, it's roughly 50x faster (ie6)</p>
- <pre class="javascript">
- function log(value) {
- document.body.innerHTML += value;
- };
- function iterate(array) {
- if (array.length) {
- try { array.shift()(); }
- finally { iterate(array); }
- }
- };
- iterate([
- function() { log(0); },
- function() { log(1); throw new Error; },
- function() { log(2); },
- function() { log(3); throw new Error; }
- ]);
- </pre>
Add Comment
Please, Sign In to add comment