I'm trying to make a .map()
method, but I'm not getting it. My last code was this:
var double = x => x * 2;
function filtro(funcao, numeros) {
let arr = [];
for (let i = 0; i < numeros.length; i++){
arr.push(numeros[i](funcao));
}
return arr;
}
console.log(filtro(double, [1, 2, 3, 4, 5, 6, 7, 8, 10]));
I would have to return: 2,4,6,4,10 .. etc ..
Can anyone help me?