Unfortunately the documentation has not caught up. In looking for examples and explanations I often find code written in the older syntax. Even worse it usually follows its own style guide. The first thing I do with a new example is to reformat it using the AirBnb style via ESLint. A friend turned me on to
eslint --fix as a tool to automate this a bit. Then I often have to refactor it to use the newer
const style variables over
var. I also introduce other refacotorings demonstrated in Martin Fowler’s Refactoring Book. Refactoring the code usually makes it more comprehensible to other developers and easier to change and maintain for me.