turingschool-examples / intermission-assignments

33 stars 218 forks source link

Speaking JavaScript #12

Closed EmilyMB closed 9 years ago

EmilyMB commented 9 years ago

Discuss Speaking JavaScript, especially following chapters here:

EmilyMB commented 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.

nathanows commented 9 years ago

Chapter 3:

Chapter 15:

Chapter 16:

Chapter 17 (aka, var couldThisChapterBeLonger = false;)

Jwan622 commented 9 years ago

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.

bmrsny commented 9 years ago

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.