Say I write this function…
var sayHi = function() {
return "hi";
}
alert(sayHi()); will return “hi”.
Now if I write it this way…
var sayHi = function(callback) {
callback("hi");
}
How do I display “hi” with this function?
Based on an example here: http://nowjs.com/doc
Try this:
Your new
sayHifunction doesn’t return a value, so you have to perform the alert in the callback function.