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.
今天听说 JavaScript 对象不过是一个普通的字典(以 python 字典为参考)
我认为这是一个错误的想法,但我不知道如何回答。
那么,你能告诉我为什么对象不是简单而枯燥的字典吗?
那么,字典项是否对字典有隐式this引用?
this
如果不是,那么 Javascript 对象就不仅仅是一个普通的字典。
正如dystroy指出的那样,this它是通过使用函数创建对象来创建的,因此它可能更多的是围绕对象的闭包。
所以在那种情况下,是的,一个对象很可能是一本字典:/