How do I make a function that takes an input, for example 13, and then executes all the functions in the array on that input and returns the output, which would be 4 in this case
array = [
function(a){ return a * 2 },
function(a){ return a + 1000},
function(a){ return a % 7 }
]
function f(array){
console.log(array);
}
if (a === 13) return 4;but I can't figure how you want to fit an array into this, and even less that array of functions you have. Mind rephrasing a bit?array.reduce((ret, fn) => fn(ret), 13)will output4