Skip to content

Instantly share code, notes, and snippets.

@rlucha
Created March 23, 2016 02:10
Show Gist options
  • Save rlucha/fcf4e51e58aaa0ab500e to your computer and use it in GitHub Desktop.
Save rlucha/fcf4e51e58aaa0ab500e to your computer and use it in GitHub Desktop.
function take(n, iterable) {
let result = [], i = 0
while (i < n) {
result.push(iterable.next().value)
i++
}
return result
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment