As we saw in Chapter 4, this happens because the process of instantiating (or inheriting from) a class means, “copy the behavior plan from that class into a physical object”, and this is done again for each new instance.īut in JavaScript, there are no such copy-actions performed. In class-oriented languages, multiple copies (aka, “instances”) of a class can be made, like stamping something out from a mold. Stop for a moment and ponder the implications of that statement. When a is created by calling new Foo(), one of the things (see Chapter 2 for all four steps) that happens is that a gets an internal ] link to the object that Foo.prototype is pointing at. ![]() ![]() Var anotherObject = var a = new Foo () Object.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |