function map(arr, fn) { let newArr = []; for (let i = 0; i < arr.length; i++) { newArr[i] = fn(arr[i], i, arr) } return newArr; } function filter(arr, fn) { let newArr = []; for (let i = 0; i < arr.length; i++) { if (fn(arr[i], i, arr)) { newArr.push(arr[i]); } } return newArr; } var arr=[1,2,3,4,5,6] console.log(map(arr,(item)=>item+1)) console.log(filter(arr,(item)=>item>3))