Prototypes in JavaScript – FunFunFunction #16



Let’s say that you have a food type, and you want to make lots of different instances of that food, such as waffles, and I don’t know why you’d want any other food than waffles, but maybe you like carrots or something. In that context, *food* is the prototype of *waffles* and *carrots*.

Some of you will be thinking – that reminds me of classes! You’d be right, but they are not the same thing, so try to put classes aside and think of prototypes as something completely new – if you try to shove prototypes into the same place in your brain where you keep classes you’ll be very unhappy.

Music by http://incompetech.com/

source

Reply


Build A Site Info