Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
从哲学上讲,为什么我不能使用这种代码在 JS 中声明一个新变量:
var this.blah = "hello"
我看到它依赖于' this '是一个已经有意义的变量,但是-究竟-如何?
极端情况和构造函数呢?
当您分配对象的属性时,您永远不需要var关键字。也就是说,你永远不应该有类似var obj.prop = ....
var
var obj.prop = ...