作者:xie392地址:https://v.douyin.com/iem4sRs7/更新时间:2024-12-21
1function isAsync(fn) {2return fn[Symbol.toStringTag] === 'AsyncFunction'3}45console.log(isAsync(async () => {})) // true6console.log(isAsync(() => {})) // false
输出结果:
1true2false