function say_yes(){
console.log("yes")
}
Obj={}
Obj=say_yes
Obj.something="something"
Obj.nothing="nothing"
在浏览器中
在上面的代码中 if i console.log(Obj),它给出了函数表达式 在上面的代码中 if i console.log(Obj.something)or console.log(Obj.nothing),它给出了属性值。当我称它为Obj()控制台 时"yes"
IN NODE 在上面的代码中,如果我 console.log(Obj),它给出
{ [Function: say_yes] something: 'something', nothing: 'nothing' }
在上面的代码中,如果 iconsole.log(Obj.something)或console.log(Obj.nothing),它给出了属性值。当我称它为Obj()控制台 时,"yes" 我真的很困惑 Obj 是一个函数吗?是对象??module.exports看到express 框架的源代码后,我产生了这个疑问
有人能解开我的疑惑吗..
catspeake
相关分类