Friday, November 9, 2018

Verify whether a JavaScript object is a function or not

 

To determine whether a certain JavaScript object is a function or not, use the following code:

var isFunction = function(obj){
   return obj.constructor.name == 'Function' ? true : false;
};

 

No comments:

Post a Comment