Home > Web Front-end > JS Tutorial > body text

Javascript study notes 6 Proposal of prototype_Basic knowledge

WBOY
Release: 2016-05-16 18:36:45
Original
833 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:

Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template