If you like there is an amazing library called underscore that provides
great deal of helpers. One of those helpers is
isFuntion() method which does the same thing as above.
I suggest you add it to your library along side jQuery since they have many other methods that you will find useful.