Execute if function from typeof

Execute if function from typeof

Hi,

I have below code to check if passed object is a function or not.

I want to know how can I execute the function if it's a function no matter what function is passed?

  1. if (typeof e.itemData.onExecute === "function")
  2. {
  3.     console.log("is function");
  4.     -------- EXECUTE THE FUNCTION ---------
  5. }
  6. else
  7. {
  8.     console.log("is NOT function");
  9. }

Thanks,