How to Check if a Variable is of Function Type
The typeof Operator
You can use the typeof operator to check the variable. It returns a string which indicates the type of the unevaluated operand.
The instanceof Operator
Another method can be the instanceof operator which checks the type of an object at run time. It return a corresponding boolean value, for example, either true or false to indicate if the object is of a particular type or not:
The toString() Method
Another useful method is toString(). Each object has a toString() method, which is called when a value of string type is expected. If the method is not overridden, it will return the object type.