Home > Web Front-end > JS Tutorial > Javascript study notes 6 Proposal of prototype_Basic knowledge

Javascript study notes 6 Proposal of prototype_Basic knowledge

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-05-16 18:36:45
Original
894 people have browsed it

First, let’s continue the code above. Let’s extend this code:

Copy the code The code is as follows:




The result is false. That is, the methods of these two objects are different methods. Then we know that in C#, each object maintains a method table, but the method table should point to the same address. If this is the case, then when we declare 100 objects, do we have to create 100 object copies? Is this a big waste of space?

So we thought of this solution, using prototype:
Copy the code The code is as follows:

Latest Issues
What are JavaScript hook functions?
From 1970-01-01 08:00:00
0
0
0
What is JavaScript garbage collection?
From 1970-01-01 08:00:00
0
0
0
c++ calls javascript
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template