Check if the intended javascript function exist or not.

Posted by Prabhukiran345 under CSS 3 category on | Points: 40 | Views : 1884
Often it is a best practice to call function only if exists..

So this can be achieved calling our required function in:
function fExist(f){
if(typeof f == "function"){
return f();

function foo(){
console.log("I am a function");


Result wil be:

because we have defined function "foo"...

Comments or Responses

Posted by: Rajesh_Kumar on: 1/23/2014 Level:Silver | Status: [Member] [MVP] | Points: 10
Gud one :)

Login to post response