Hello I am new to node js and I am trying to write a simple callback function however get "ReferenceError: sum1 is not defined", can anyone help me? code:
sum1(1,2, function(sum){
console.log(3 + sum);
});
sum1 = function (a,b, callback){
callback(a + b);
};
However, I tried to use
function sum1(a,b,callback){...}
and it works. Is this a naming problem? Can anyone explain a little bit?