Skip to content

Instantly share code, notes, and snippets.

@grantsheppard
Created April 6, 2017 04:11
Show Gist options
  • Save grantsheppard/273b16742e75f82a10a4363c94918eb7 to your computer and use it in GitHub Desktop.
Save grantsheppard/273b16742e75f82a10a4363c94918eb7 to your computer and use it in GitHub Desktop.
const imperativeDouble = numbers => {
const doubled = []
for (i = 0; i < numbers.length; i++) {
doubled.push(numbers[i] * 2)
}
return doubled;
}
const declarativeDouble = numbers => numbers.map(n => n * 2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment