Skip to content

Instantly share code, notes, and snippets.

@Lily-La-Day
Created August 30, 2019 07:37
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save Lily-La-Day/ef1415e7c8d7af3f71f60eb0fe4d4e32 to your computer and use it in GitHub Desktop.
//simple example
function repeat(n, action) {
for (let i = 0; i < n; i++) {
action(i);
}
}
repeat(3, console.log);
//array methods map/reduce/forEach etc
const arr1 = [1, 2, 3];
const arr2 = arr1.map(function(item) {
return item * 2;
});
console.log(arr2);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment