2 ms·
1) Get cozy with ES6 modules. Now, JavaScript can be treated like a real programming language composed of code from files. 2) Scope. JavaScript still uses le
by austin-cheney 3y ago
1) Get cozy with ES6 modules. Now, JavaScript can be treated like a real programming language composed of code from files.
2) Scope. JavaScript still uses lexical scope. This remains its only scope system, which is fantastic. Now, its better because you have let and const which are block scoped, so don't use var any more.
3) Absolutely everything you need from this language can be reduced to either a data structure, a function, a primitive, and APIs. The result is really clean code if you don't need somebody else to clean your room and do your laundry for you.
4) Don't use the keyword this or anything reliant upon it.
5) Events. Get comfortable with asynchronous programming. For some reason callbacks scare the shit out of new programmers. Its just functions. If it scares you too there are promise chains and async/await. But bear in mind you can always halt a function with a return statement, but you cannot prematurely exit a promise chain.
Those are the important things. Less important things that I use all the time:
* Object.keys(myObject) // returns a string array of the property names
* TypeScript. I declare everything against some type description including function return types and function arguments. This helps identifies errors and reduces a weeks worth of refactoring down to about 2 hours max.
* Node.js. Get familiar with the language in the browser first and then spend time with Node.
Good luck.