Code is meant for communication, but it can get obscure if we’re not careful. Learn how comments let us provide documentation to ourselves and others.
- [Narrator] In this video, we're going to comments,…which are used for documenting and disabling…parts of your code.…The most important function for…comments probably is documentation.…That is, adding pieces of code that don't execute,…that can be read by other human beings…to understand what's going on in your program.…These come in two styles in JavaScript.…One is the line comment…which starts with two slash characters like this…and then anything after that on the same line…doesn't execute.…These can be at the beginning of a line like this,…or anywhere else.…
So if I wanted to document one of…these variable assignments for some reason,…I can put a line comment right here…towards the end of the line…and that works just fine.…This is not really documentation of the year.…It's clear enough from the variable name what it's doing…but this does work, is the point.…The other function of a JavaScript…comment is to disable parts.…so if I want say, this line, the day…not to execute anymore.…I can comment it out.…Let's copy this…
Author
Released
2/5/2019- Using a text editor
- Declaring and assigning variables
- Booleans and the quest for truth
- Working with objects and arrays
- Using operators and control structures
- Iterating with loops
- Objects, references, and functions
- Promises, async, and await
Skill Level Beginner
Duration
Views
Related Courses
-
JavaScript for Web Designers
with Joe Chellman2h 43m Beginner -
Learning App Building with Vanilla JavaScript
with Sasha Vodnik1h 44m Intermediate
-
Introduction
-
1. Getting Started
-
Versions of JavaScript1m 43s
-
Additional helpful resources2m 25s
-
2. Variables and Types
-
3. Objects, Arrays, and More
-
Objects3m 21s
-
Objects for modeling data2m 20s
-
Manipulating objects3m 52s
-
Arrays4m 55s
-
Manipulating arrays5m 43s
-
Readability: Whitespace2m 35s
-
Readability: Comments4m 7s
-
Regular expressions5m 43s
-
-
4. Operators and Control Structures
-
Simple comparisons4m 10s
-
Arithmetic operators5m 24s
-
Logical operators5m 43s
-
Conditionals: If6m 21s
-
Conditionals: Switch3m 53s
-
Terse ifs4m 59s
-
Ternary operator2m 30s
-
Type checking5m 30s
-
-
5. Iterating with Loops
-
For loops: Sequential6m 9s
-
For loops: Enumerative4m 33s
-
While loops5m 36s
-
-
6. Functions
-
Basic functions2m 40s
-
Arguments in functions4m 23s
-
More on arguments5m 45s
-
Functions are objects4m 18s
-
Jargon: Scope in JavaScript1m 55s
-
Variable scope in functions3m 20s
-
Jargon: Callback functions3m 31s
-
-
7. More Advanced Pieces
-
Promises, async, and await3m 26s
-
Modern JavaScript tooling3m 21s
-
Conclusion
-
Next steps3m 38s
-
- 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.
CancelTake 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.
Share this video
Embed this video
Video: Readability: Comments