Created
March 2, 2018 13:40
-
-
Save ShahinAhmed7/e9db0b95b5d760bc76ad00d038aacf7d to your computer and use it in GitHub Desktop.
ES6 For loop// source http://jsbin.com/weganat
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<script src="http://fb.me/react-with-addons-0.14.0.js"></script> | |
<script src="http://fb.me/react-dom-0.14.0.js"></script> | |
<meta charset="utf-8"> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<div id=example></div> | |
<h1>Hello world</h1> | |
<script id="jsbin-javascript"> | |
//jshint esnext:true | |
'use strict'; | |
var cars = ['BMW', 'City', 'Nano', 'Audi']; | |
var _iteratorNormalCompletion = true; | |
var _didIteratorError = false; | |
var _iteratorError = undefined; | |
try { | |
for (var _iterator = cars[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { | |
var car = _step.value; | |
console.log(car); | |
} | |
} catch (err) { | |
_didIteratorError = true; | |
_iteratorError = err; | |
} finally { | |
try { | |
if (!_iteratorNormalCompletion && _iterator['return']) { | |
_iterator['return'](); | |
} | |
} finally { | |
if (_didIteratorError) { | |
throw _iteratorError; | |
} | |
} | |
} | |
</script> | |
<script id="jsbin-source-html" type="text/html"><!DOCTYPE html> | |
<html> | |
<head> | |
<script src="//fb.me/react-with-addons-0.14.0.js"><\/script> | |
<script src="//fb.me/react-dom-0.14.0.js"><\/script> | |
<meta charset="utf-8"> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<div id=example></div> | |
<h1>Hello world</h1> | |
</body> | |
</html></script> | |
<script id="jsbin-source-javascript" type="text/javascript"> | |
//jshint esnext:true | |
let cars = ['BMW', 'City', 'Nano', 'Audi']; | |
for (let car of cars){ | |
console.log(car); | |
} | |
</script></body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//jshint esnext:true | |
'use strict'; | |
var cars = ['BMW', 'City', 'Nano', 'Audi']; | |
var _iteratorNormalCompletion = true; | |
var _didIteratorError = false; | |
var _iteratorError = undefined; | |
try { | |
for (var _iterator = cars[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { | |
var car = _step.value; | |
console.log(car); | |
} | |
} catch (err) { | |
_didIteratorError = true; | |
_iteratorError = err; | |
} finally { | |
try { | |
if (!_iteratorNormalCompletion && _iterator['return']) { | |
_iterator['return'](); | |
} | |
} finally { | |
if (_didIteratorError) { | |
throw _iteratorError; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment