There is no reason not to use typeof
.
Not only is it faster but the ECMAScript specification ensures that all functions have a type of "function" and that only functions can have a type of "function" :
This operator was specifically designed to get the type of a value, so why not use it ?
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…