Closed EmilyMB closed 9 years ago
I'm finding Chapter 15 hard to digest...anyone else running into that issue? After a while all the terms seems to coalesce into a mush heap of gobbledy goop.
Chapter 3:
Chapter 15:
Chapter 16:
Chapter 17 (aka, var couldThisChapterBeLonger = false;
)
I don't get prototypes. Why is this:
function Person(name) { this.name = name; } The object in Person.prototype becomes the prototype of all instances of Person. It contributes part 2: Person.prototype.describe = function () { return 'Person named '+this.name; }; Let’s create and use an instance of Person:
var jane = new Person('Jane'); jane.describe() 'Person named Jane'
Specifically, I don't get this line:
The object in Person.prototype becomes the prototype of all instances of Person.
I think prototypes are sticking in a little more. I was confused on when to use a constructor verse a prototype. So I think the problem with Constructors is that when using a constructor like var person1 = New Person, it creates the methods for each object. Versus using a prototype which will use the same methods for all objects, better on performance or memory possibly too.
Discuss Speaking JavaScript, especially following chapters here: