[英]What is the correct typeof a JavaScript function?
Most people know that all functions in JavaScript are actually objects, but why is it that typeof function() {}
returns function
instead of object
? 大多数人都知道JavaScript中的所有函数实际上都是对象,但为什么
typeof function() {}
返回function
而不是object
? By this logic, why does typeof []
not return array
? 通过这个逻辑,为什么
typeof []
不返回array
?
Is this just a 'standard' that is followed or is there a valid reason? 这只是一个遵循的“标准”还是有正当理由?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.