Skip to content

Instantly share code, notes, and snippets.

@ranamahmud
Created November 7, 2020 06:54
Show Gist options
  • Save ranamahmud/c48fbc9d87689fc4859cc54d5a5fb271 to your computer and use it in GitHub Desktop.
Save ranamahmud/c48fbc9d87689fc4859cc54d5a5fb271 to your computer and use it in GitHub Desktop.
const nums = [1, 2, 3, 4, 5, 6, 7, 8, 9];
function double(num) {
return num * 2;
}
const doubleNums = nums.map(double);
console.log(doubleNums)
\\ [2, 4, 6, 8, 10, 12, 14, 16, 18]
const doubleNums2 = nums.map(number => number * 2);
console.log(doubleNums2)
\\ [2, 4, 6, 8, 10, 12, 14, 16, 18]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment