I can't imagine how to solve this task, can you give me some guidance or an example
Write a function process(arr, f) where arr is an array argument and f() is a callback function that expects an array parameter.
process() returns the result of the function f() applied to the array.
Make calls to process() using different f() functions - for example:
- with a function calculating the sum of the elements of the parameter array
I've only do this but i didn't think im on a right track
let arg = [1,2,3]
function process(arr, f){
alert(f(arr));
}
Write a function process(arr, f) where arr is an array argument and f() is a callback function that expects an array parameter.
process() returns the result of the function f() applied to the array.
Make calls to process() using different f() functions - for example:
- with a function calculating the sum of the elements of the parameter array
I've only do this but i didn't think im on a right track
let arg = [1,2,3]
function process(arr, f){
alert(f(arr));
}