1. It has objects and can contain data and data processing methods. Objects can contain other objects. He has no class (before javascript2.0 is actually implemented), but it has a constructor that can do what the class can do, including containers and roles that play variables and methods. It does not have class-based inheritance, but it has prototype-based inheritance. The two methods to create an object system are inherited and aggregated. JavaScript.
2. Some comments say that javascript is not really object-oriented because it cannot provide information hiding. That is, the object cannot have private variables and private methods: all members are public. However, some people subsequently demonstrated that javaScript objects can have private variables and private methods. In addition, it was criticized that javascript cannot provide inheritance, but some people later proved that javascript not only supports traditional inheritance, but also applies other code reuse modes.
3. javascript is an object-based language, which is a correct and slightly conservative judgment. javascript is not object-oriented, which in my opinion is a false perception, in fact, there are ample reasons to prove that javaScript is an object-oriented language, but javaScript is different from the traditional class-based object-oriented language, this uniqueness is called prototype-Based Object-Oriented.
-----------------------------------------
Because js is a weak type language, unlike c ++ and C! He does not support function method overloading. You have previously written a method. Then, write another method with the same name. By default, he will overwrite the previous method! This is the same as that in PHP!
It does not support function overloading in languages such as C #. Different methods are called based on different parameters and return values!
Javascript is not object-oriented. It is not completely object-oriented. It can also be written as classes, methods, and attributes, but it is slightly different from other languages! For example
Var cls = {
My: {a: 0 },
Init: function ()
{
Alert (this. my. );
}
};
Window. onload = function ()
{
Cls. init ();
}
Call cls. init ();
This is his class, but it lacks a lot of object-oriented features. It is very clear above! So he is not completely object-oriented.
Object-oriented is just a way of thinking and a way of thinking!