js判断函数是否存在并且执行

//执行回调函数
typeof fn === "function" ? fn() : false;
原文地址:https://www.cnblogs.com/silences/p/8033019.html