Passing anonymous function as callback in Javascript
Is there a way to pass anonymous function as a custom callback function in Javascript? I have this code: function notifyme(msg){ console.log(msg) } notifyme("msg", function(){ //do some custom redirect logic }); I am trying the above code and it's executing notifyme function, but not going further with redirect code. I know I can pass a function name as a callback, but I don't have a specific function that I can pass. This is why they invented the anonymous function I guess. It'd be really nice if there was a way to do that. Your code pattern should be like function notifyme(msg,callback){