【发布时间】:2019-10-13 23:35:33
【问题描述】:
Javascript 中的函数是一个对象。
在函数上运行 typeof 时,为什么返回值是“function”,而不是“object”?
var objLit = {}
console.log(typeof objLit); // "object"
function hello() {
console.log("hello world");
}
console.log(typeof hello); // "function"
【问题讨论】:
-
哼,因为
hello是一个函数,而不是Object -
西蒙,
hello是一个对象。link
标签: javascript typeof