Skip to content

Instantly share code, notes, and snippets.

@z81
Last active April 15, 2022 14:32
Show Gist options
  • Save z81/acdb8ce906512c6c41a07750b54bfa83 to your computer and use it in GitHub Desktop.
Save z81/acdb8ce906512c6c41a07750b54bfa83 to your computer and use it in GitHub Desktop.
untitled
const map = (arr, cb) => {
const res = [];
for(let v of arr) {
res.push(cb(v));
}
return res;
};
const c = map([1, 2, 3], v => v * 2);
const x = [[1, 2], [3, 4]].map(v => v.map(x => x * 2));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment