Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const map = (func, arr) => {
- const newArr = [];
- for (const el of arr) {
- const newEl = func(el);
- newArr.push(newEl);
- }
- return newArr;
- };
- console.log(
- map(b => b + 's', ['kestrel', 'kite']),
- map(p => p.age, persons)
- );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement