JavaScript: Best Practices for Functions and Classes
Offered By: LinkedIn Learning
Course Description
Overview
Learn how to generate more consistent and easier-to-maintain JavaScript. Discover keys and tools to build better programs and to help improve code organization and quality.
Syllabus
Introduction
- Creating well-structured modular JavaScript
- What you should know
- Setting up your environment
- Understanding style guides
- Using modern deployment tools
- Understanding ESLint
- Foundational practice: Always use strict mode
- Use function expressions instead of declarations
- Don't use the new keyword to construct functions
- Leave parameter values untouched
- Use arrow syntax for anonymous functions
- Rely on implicit return only when obvious
- Challenge: Create functions
- Solution: Create functions
- Use PascalCase for naming classes and constructors
- Use this only in classes or constructors
- Return this from methods
- Don't assign this to another variable
- Challenge: Create classes
- Solution: Create classes
- Configure module settings in ESLint
- Default export constants when possible
- Use case to indicate a module's default export type
- Use object destructuring
- Use array destructuring
- Challenge: Destructure
- Solution: Destructure
- Avoid eval
- Avoid == and !=
- Avoid with
- Avoid unary increments and decrements
- Next steps
Taught by
Sasha Vodnik
Related Courses
4ever-clojureIndependent Advanced JavaScript 1: Objects, Loops, Hoisting
Scrimba via Coursera Modern JavaScript with ES6
Packt via Coursera Build a REST API with Express 5 and node 14
egghead.io JavaScript ES6, ES7, ES8: Learn to Code on the Bleeding Edge (Full Course)
freeCodeCamp