André Bargull (2014-09-10T20:28:00.000Z)
domenic at domenicdenicola.com (2014-09-10T21:26:54.743Z)
Just for the sake of completeness, here is complete translation of `for-of` to ES5 syntax. ES6 for-of statement: ```js for (var value of iterable) { if (doReturn) return; if (doBreak) break; if (doContinue) continue; otherExpression; } ``` Translated to ES5 syntax: ```js var $iterable = iterable; if ($iterable === undefined || $iterable === null) { throw new TypeError(); } var $iterator = Object($iterable)[Symbol.iterator](); if (Object($iterator) !== $iterator) { throw new TypeError(); } while (true) { var $nextResult = $iterator.next(); if (Object($nextResult) !== $nextResult) { throw new TypeError(); } if ($nextResult.done) { break; } var $nextValue = $nextResult.value; var $callClose = false; try { value = $nextValue; if (doReturn) { $callClose = true; return; } if (doBreak) { $callClose = true; break; } if (doContinue) continue; otherExpression; } catch ($exception) { try { if ("return" in $iterator) { $iterator.return(); } } catch ($ignore) { // ignore } throw $exception; } finally { if ($callClose) { if ("return" in $iterator) { $iterator.return(); } } } } ```