jQuery可以用 isFunction() 來進行判斷

如果僅使用Javascript可以使用以下的方法

function isFunction(fn){
    return typeof fn === 'function'
}

function isDefined(foo){
    return typeof(foo) !== 'undefined'
}

相关文章:

  • 2021-10-27
  • 2022-12-23
  • 2022-12-23
  • 2021-12-02
  • 2022-12-23
  • 2021-07-25
  • 2022-12-23
  • 2021-11-27
猜你喜欢
  • 2022-12-23
  • 2022-02-04
  • 2021-08-20
  • 2021-12-04
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案