How to tell if a JavaScript function is defined

How do you tell if a function in JavaScript is defined?

I want to do something like this

function something_cool(text, callback) {
    if( callback != null ) callback();

But it gets me a

callback is not a function

error when callback is not defined.


typeof callback === "function"