test if something is a function

by Gerald Gillespie

HTML

d1:<span id="d1"></span>

<br/>d2:<span id="d2"></span>

JavaScript

var str = 'something';

var fn = function(){};


if (typeof str == 'function'){
   alert(typeof str);
}