Skip to content

Instantly share code, notes, and snippets.

@larytet
Last active March 17, 2018 13:56
Show Gist options
  • Save larytet/15e958aff2af766aea444abaf7768896 to your computer and use it in GitHub Desktop.
Save larytet/15e958aff2af766aea444abaf7768896 to your computer and use it in GitHub Desktop.
<!DOCTYPE HTML>
<html>
<body>
<p>Before the script...</p>
<script>
function* range(begin, end, step=1) {
for (var i = begin; i != end; i += step) {
yield i;
}
};
window.onload = function() {
for (var i of range(1,50)) {
if (!(i % 2)) {
console.log(i);
}
}
};
</script>
<p>...After the script.</p>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment