Skip to content

Instantly share code, notes, and snippets.

@sharikovvladislav
Created May 14, 2017 00:20
Show Gist options
  • Select an option

  • Save sharikovvladislav/8aed1ede4b6b95c7f6625d16e86d7c04 to your computer and use it in GitHub Desktop.

Select an option

Save sharikovvladislav/8aed1ede4b6b95c7f6625d16e86d7c04 to your computer and use it in GitHub Desktop.
<html>
<head>
<title>Test</title>
</head>
<body>
Test iterator
<script>
const gen = function* () {
debugger; const a = yield 10;
debugger; const b = yield;
debugger; yield a + b;
};
const corutine = gen();
const result = corutine.next();
corutine.next(result.value);
console.log(corutine.next(15));
// { value: 25, done: false }
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment