JavaScript: Best Practices for Data

JavaScript: Best Practices for Data

1h 25mIntermediate2020-04-13

Authors

Sasha Vodnik

Sasha Vodnik

Principal Technical Course Developer at DocuSign

Course details

You know you want to write JavaScript code for maximal consistency, maintainability, and comprehensibility. Logic is one thing—data is another. This course explores the tools and approaches for keeping your data and data structures clean, uncluttered, and efficient. Instructor Sasha Vodnik introduces best practices from industry-standard style guides and introduces tools that will help you flag deviations as well as format code as you write it. He discusses moderns strategies for creating and using variables, assigning values, typecasting values, and making comparisons. These are the techniques that experienced JavaScript programmers use to optimize the way their applications handle data and keep their code up to date with the latest standards.

Topics include:
- Style guides
- Modern deployment tools
- Better ways to declare variables
- Removing unused variables
- Assigning values
- Creating arrays and objects using literals
- Typecasting strings, numbers, and Booleans
- Comparing values appropriately
- Adding parentheses to clarify logic

Skills covered

JavaScriptOracleProgramming LanguagesSoftware DevelopmentDeep Dive (X:Y)

Concepts

Introduction

  • Working effectively with JavaScript data
  • What you should know
  • Setting up your environment

Why Best Practices

  • Understanding style guides
  • Using modern deployment tools
  • Understanding ESLint
  • Foundational practice - Always use strict mode

Declaring Variables

  • Prefer const, then let
  • Use individual statements to create variables
  • Create descriptive variable names
  • Standardize acronym case
  • Remove unused variables
  • Challenge - Declare variables
  • Solution - Declare variables

Assigning Values

  • Don't assign variables in chains
  • Standardize quotes
  • Create arrays and objects using literals
  • Quote object property names consistently
  • Challenge - Assign values
  • Solution - Assign values

Type Casting

  • Type cast strings with the String wrapper
  • Type cast numbers with the Number wrapper
  • Type cast Booleans using double negation
  • Rely on implicit Boolean values in conditionals
  • Challenge - Type cast
  • Solution - Type cast

Comparing Values

  • Use triple-character equality operators
  • Don't use Yoda conditions
  • Compare appropriately for the data type
  • Use ternary statements judiciously
  • Add parentheses to clarify logic
  • Challenge - Compare values
  • Solution - Compare values

Conclusion

  • Next steps
40,000 Toman