« Return to Thread: Using IsCallable Operation?

Re: Using IsCallable Operation?

by Mark S. Miller-2 :: Rate this Message:

Reply to Author | View in Thread

On Fri, Jun 5, 2009 at 7:22 PM, Garrett Smith <dhtmlkitchen@...> wrote:

function isCallable(obj, prop) {
 var type = typeof obj[prop];
 if(isNewTypeof) {
   return type === "function";
 } else {
   // fallback "best practice".
 }
}


 function isCallable(obj, prop) {
   var type = typeof obj[prop];
   if (function(){"use strict";return this;}()) {
     // fallback "best practice".
   } else {
     return type === "function";
   }
 }


--
   Cheers,
   --MarkM

_______________________________________________
es-discuss mailing list
es-discuss@...
https://mail.mozilla.org/listinfo/es-discuss

 « Return to Thread: Using IsCallable Operation?