Although spaces are optional in comments, their use can be helpful for anyone reading them. In this video, learn how to write comments that make the best use of spaces and discover why spaces should be included.
- [Instructor] Spaces are optional in comments, … but you can include them to increase … the legibility of your comments. … In particular, it's a common practice to include a space … between the starting comment characters … and the commented code. … I can already see that in the format for my start block. … I'm going to add a single line comment before my variable … just to mark this as a section that contains variables. … So I'll add a blank line to keep some space from U strict, … and then I can just do a single line, slash slash, … and variables. … Now at a glance, it takes a little work … to see where the slashes end and the word variables begins. … But if I click in here and stick a space … after the second slash, it immediately becomes easier … to recognize that as a comment … containing the word variables. … ESLint contains a spaced comment rule … that let's me specify whether … comments should include spaces. … The documentation makes it clear that you can get … fairly detailed for this rule. …
- 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
Skill Level Intermediate
Workflow Tools for Web Developerswith Christina Truong1h 13m Intermediate
Set up your environment3m 22s
1. Why Best Practices?
2. Creating Comments
3. Using Punctuation
4. Using Spacing
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.