Joke Collection Website - Joke collection - How javascript embodies inheritance
How javascript embodies inheritance
Because js is an object model of prototype, there are no classes in the strict sense. They are all objects.
To achieve inheritance, you can first
//Create parent object
OldObject=function(){
This.a= "Attribute 1 "
};
//Copy a new object, which already contains the contents of the old object.
new object = new old object();
//Add something and expand a new object.
NewObject.b = " Attribute 2
NewObject.func=function(){
//New method 1
}
//The new object has the properties of the old object.
alert(new object . a);
Reward points
============================
Ext js can realize object-oriented, you can go and see this.
- Previous article:Beautiful sentences on Douyin
- Next article:This is my composition. I am a boy.
- Related articles
- A joke about giving a red envelope to the boss's wife.
- 3-second English story
- Tell a joke: "Once upon a time there was a eunuch, below ..."
- Eggs tell jokes
- Experience in reading 800 words of Bird Collection
- Want to go whoring again, don't give money.
- 30 winter vacation diaries, about 100 words.
- Feelings are just a joke. The sentence is very short.
- True feelings are suitable for primary school students to kneel for cross talk lines! ! ! ! ! ! ! Urgent need! ! ! ! ! ! !
- Let's talk about some love stories with song names and jokes with star names.