July 2012
Beginner to intermediate
342 pages
7h 27m
English
The functional mock-up created in the previous recipe can be useful for gaining mental traction with a concept (that is, getting our head around it), and may be perfectly adequate for small, simple modules with narrow scope.
However, the prototype pattern (among others) is commonly used by module creators, often used in Node's core modules and is fundamental to native JavaScript methods and objects.
Prototypical inheritance is marginally more memory efficient. Methods sitting on a prototype are not instantiated until called, and they're reused instead of recreated on each invocation.
On the other hand, it can be slightly slower than our previous recipe's procedural style because the JavaScript engine ...
Read now
Unlock full access