JavaScript: Best Practices for Code Formatting

JavaScript: Best Practices for Code Formatting

JavaScript offers developers tremendous power, but also a wide variety of code style choices. Its evolution over decades and shifts in audience and approach have left communities fragmented and impeded code sharing. In this course, longtime coder and teacher Sasha Vodnik provides a core set of practices for creating code that can be read by more people than its creators. Learn about formatting details like commenting, punctuation, and spacing to maximize your code's ability to travel and thrive.

Topics include:

  • Using modern deployment tools
  • Working with ESLint
  • Creating easy-to-read comments
  • Using commas consistently
  • Standardizing line length in your code
  • Using a consistent format for blocks
  • Choosing and implementing a standard indent

课程信息

  • 英文名称:JavaScript: Best Practices for Code Formatting
  • 时长:1小时50分
  • 字幕:英语

课程目录

  1. Modern standards for your JavaScript
  2. What you should know
  3. Set up your environment
  4. Style guides
  5. Use modern deployment tools
  6. ESLint
  7. Foundational practice: Use strict mode
  8. Use single-line syntax for single lines
  9. Multi-line syntax with leading asterisks
  10. Include leading spaces in comments
  11. Challenge: Create JavaScript comments
  12. Solution: Create JavaScript comments
  13. End statements with a semicolon
  14. Don't rely on auto semicolon insertion
  15. Standardize line length
  16. Use commas consistently
  17. Include a comma in a list of values
  18. Challenge: Optimize punctuation
  19. Solution: Optimize punctuation
  20. Indent consistently
  21. Space before and after operators
  22. Use a consistent format for blocks
  23. Include a space after keywords and arrows
  24. Use consistent spacing before function signature parentheses
  25. Break up and indent long-method chains
  26. Space consistently within enclosing characters
  27. Space after commas, but not before
  28. Limit blank space to one line
  29. Challenge: Optimize spacing
  30. Solution: Optimize spacing
  31. Next steps

评论