JavaScript is not a real object-oriented language, it is a prototyping language, that is the difference with other object-oriented languages. In Javascript, you don’t use classes, you create objects from other objects.
Because JavaScript is a functionally scoped language creating a function and/or variable which is not wrapped in another function will result in that variable being created in the global scope (window). To combat this, developers place their classes in Objects.
Because JavaScript is a functionally scoped language creating a function and/or variable which is not wrapped in another function will result in that variable being created in the global scope (window). To combat this, developers place their classes in Objects.
本文探讨了JavaScript作为一种基于原型的语言的特点,区别于传统的类为基础的对象导向语言。JavaScript通过从其他对象创建新对象的方式实现继承,同时介绍了变量作用域及开发者如何通过对象来组织类。
1982

被折叠的 条评论
为什么被折叠?



