Skip to content

Instantly share code, notes, and snippets.

@Alamin02
Created June 28, 2020 18:35
Show Gist options
  • Save Alamin02/8ad68742df18d8271127983036c427f8 to your computer and use it in GitHub Desktop.
Save Alamin02/8ad68742df18d8271127983036c427f8 to your computer and use it in GitHub Desktop.
function* makeEvenNumberIterator(start, end) {
const sequence = [];
const firstValue = start % 2 === 0 ? start: start + 1;
for (i = firstValue; i <= end; i = i + 2) {
yield i;
}
return sequence;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment