I am learning javascript callback or higher order functions. Please help me in understanding the mistake in the following functions. I am trying to call more than function as callback functions. Is it not allowed?
My code is:
var firstFunction = function(item1){
console.log("calling firstFunction");
console.log(item1);
}
var secondFunction = function(item2, f1){
console.log("calling secondFunction");
f1(item2);
}
//secondFunction("first", firstFunction);
var thirdFunction = function(item3, f2,f1){
console.log("calling thirdFunction");
f2(item3);
}
thirdFunction("second", firstFunction, secondFunction);