判断是否为异步函数
function isAsyncFun(func) {
return Object.prototype.toString.call(func) === '[object AsyncFunction]';
}
console.log(isAsyncFun(function () {}));
console.log(isAsyncFun(async function () {}));
判断是否为奇数
function isOod(n){
return n % 2 === 1 || n % 2 === -1;
}
Comment here is closed