Class Central is learner-supported. When you buy through links on our site, we may earn an affiliate commission.

LinkedIn Learning

JavaScript: Best Practices for Functions and Classes

via LinkedIn Learning

Overview

Limited-Time Offer: Up to 75% Off Coursera Plus!
7000+ certificate courses from Google, Microsoft, IBM, and many more.
Learn how to generate more consistent and easier-to-maintain JavaScript. Discover keys and tools for building 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
1. Why Best Practices?
  • Understanding style guides
  • Using modern deployment tools
  • Understanding ESLint
  • Foundational practice: Always use strict mode
2. Creating Functions
  • 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
3. Creating Classes
  • 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
4. Creating Modules
  • Configure module settings in ESLint
  • Default export constants when possible
  • Use case to indicate a module's default export type
5. Destructuring
  • Use object destructuring
  • Use array destructuring
  • Challenge: Destructure
  • Solution: Destructure
6. JavaScript Features to Avoid
  • Avoid eval
  • Avoid == and !=
  • Avoid with
  • Avoid unary increments and decrements
Conclusion
  • Next steps

Taught by

Sasha Vodnik

Reviews

4.8 rating at LinkedIn Learning based on 72 ratings

Start your review of JavaScript: Best Practices for Functions and Classes

Never Stop Learning.

Get personalized course recommendations, track subjects and courses with reminders, and more.

Someone learning on their laptop while sitting on the floor.