Escribí el código para iterar a través de una matriz determinada y luego invoqué la función subtractTwo en cada elemento. Sin embargo, cuando ejecuto el mapa de funciones, el argumento de la matriz no cambia. ¿Alguien sabe por qué puede ser esto?
// create the subtractTwo function, callback function function subtractTwo (number) { return number - 2; } // create higher-order function, map function map (array, callback) { // initiate a for loop, looping through the array and invoking the callback on each element; for (let i = 0; i < array.length; i ++) { callback(array[i]); } //return the new array return array; } //console.log(subtractTwo(4)); // Uncomment these to check your work! console.log(typeof subtractTwo); // should log: 'function' console.log(typeof map); // should log: 'function' console.log(map([3,4,5], subtractTwo)); // should log: [ 1, 2, 3 ]```