<p>How do you tell if a function in JavaScript is defined?</p>

<p>I want to do something like this</p>

<pre><code>function something_cool(text, callback) {
    alert(text);
    if( callback != null ) callback();
}
</code></pre>

<p>But it gets me a</p>

<blockquote>
  <p>callback is not a function</p>
</blockquote>

<p>error when callback is not defined.</p>

```
```
typeof callback === "function"
```
```