You would structure your function like this:
function one(x, y, z, callback) {
Then, since functions are objects that you could pass to functions through a callback parameter, IE:
one(1, 2, 3, function(){alert('hello');});
or
var func = function() { alert('hello'); }; one(1, 2, 3, func);
or
function func() { alert('hello'); } one(1, 2, 3, func);
source share