John Slegers
2 min readNov 9, 2018

--

The use of __proto__ is controversial, and has been discouraged. Teaching this to new programmers is a really big nono IMO.

The correct, standard, cross-browser way to to prototypal inheritance is this pattern :

function Circle() {
...
}

Circle.prototype = Object.create(Shape.prototype);

Circle.prototype.draw = function() {
...
};

...

Additionally, I noticed you mentioned there used to be three modular standards : AMD, RequireJS & CommonJS. This is wrong as well.

AMD is the module standard used by both Dojo & RequireJS. There IS a third standard, which is called UMD. UMD is a somewhat verbose alternative to AMD & CommonJS that is compatible with both. This means that UMD modules can be used both by loaders that support AMD and loaders that support CommonJS.

Considering each of these three module standards is still used a lot by legacy libraries, it would also have been helpful if you included some examples of those standards in your handbook as well.

It strikes me as odd, really, that you mention ancient, deprecated techniques like __proto__ while at the same time telling people to “always use the latest ES version” and giving code examples for only the fairly new ES6 modules, even though about 20% of all browsers still don’t support it (according to caniuse). And this gives me very little confidence in the rest of the handbook.

Another thing I found lacking, is information on which features are safe to use in older browsers. For example, Array.prototype.map() is safe to use everywhere including IE9 and up. And it can be polyfilled if you need even older browsers. So it is truly safe to use anywhere.

In contrast, for...of is not supported by a single version of IE and can not be polyfilled. So for projects where IE is important (yes, those still exist) you can not use for...of unless you first transpile it with Babel. And I don’t think using Babel to transpile ES6 to ES5 by default is a good recommendation unless people are aware of the consequences. And there’s still projects out there that use legacy toolchains that don’t allow easy inclusion of Babel.

I haven’t gone through most of the rest of your handbook, but if feels too superficial to be really useful. It certainly doesn’t feel nearly as “complete” as its name suggests. And the mixture of only very old and only very new along with too limited info on browser support or consequences of transpilation with Babel is sufficient reason for me to avoid recommending this resource to new JS programmers. So I’d very much recommend you to fix these issues.

--

--

John Slegers
John Slegers

Written by John Slegers

PERSONALITY: - - - - - - rebel, geek, philosopher - - - - - - INTERESTS: programming, UX , design, human sciences, board gaming, movies, retro-futurism

No responses yet