1 It possesses objects that can contain data and methods of processing data. Objects can contain other objects. He has no class (before javascript2.0 really implemented), but it has constructors that can do what the class can do, including containers and roles that act as variables and methods. He does not have a class based inheritance, but it has a prototype based inheritance. Two ways to establish an object system are through inheritance and through aggregation. There are two JavaScript.
2 Some evaluations say that JavaScript is not really object-oriented because it does not provide the hidden information. That is, an object cannot have a private variable and a private method: all members are public. But then someone proved that JavaScript objects can have private variables and private methods. There is also criticism that JavaScript does not provide inheritance, but it was later proved that JavaScript not only supports traditional inheritance but also applies other code reuse patterns.
3 said that JavaScript is an object-based language, is a correct and slightly conservative judgment, and that JavaScript is not object-oriented, in my view is wrong cognition, in fact there is ample reason to prove that JavaScript is an object-oriented language, It's just that JavaScript has a different place than a traditional class-oriented object, which we call a prototype based object-oriented.
-----------------------------------------
Because JS is a weakly typed language. Unlike c++,c#, this type of language! He does not support function method overloading. You write a method before. He will override the previous method by default! This situation is the same as in PHP!
He doesn't look like C #. Languages support function overloading. Depending on the parameters, the return value calls a different method!
About JS is not object oriented. He is not entirely object-oriented, he can also write classes, methods, attributes. But it's a little different than any other language!
var cls={
my:{a:0},
Init:function ()
{
alert (THIS.MY.A);
}
};
Window.onload=function ()
{
Cls.init ();
}
Call Cls.init ();
This is his class, but a lot of object-oriented features are missing. The upstairs is very clear! So he's not completely object-oriented.
Object-oriented is just a way of thinking to solve the problem!