Lists of values are separated by commas, but no comma is required after the final one. In this video, learn how to implement commas in a way that reduces future errors and explain how terminal commas are useful.
- [Instructor] Lists of values like array elements, … key value pairs and object literals, … and function arguments … require comma's to separate values. … No comma is required at the end, … but when you're using a multiline format … for a series of values, … and you're using a terminal comma format … rather than putting commas at the beginning of the line, … then it's a best practice to include a comma … after the last item as well. … There are a couple of solid reasons for this. … First, it makes it harder to omit a comma between items … when you add it to your list, … because the comma that used to be at the end, … automatically becomes the separator before the new item. … The terminal comma also makes diff's cleaner, … as you don't see a separate deletion … and insertion for the added comma. … Instead, the only change is the newly inserted line. … In the fetch code in my app.js file for my local events app, … I'm specifying an object containing a couple of properties. … I need to add another one, …
- 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.