Comments
Comments are notes in your code that JavaScript ignores. They help explain what your code does and make it easier to understand.
Single-Line Comments
Use // for single-line comments:
Loading JavaScript Playground...
Multi-Line Comments
Use /* */ for multi-line comments:
Loading JavaScript Playground...
Why Use Comments?
Comments serve several purposes:
Loading JavaScript Playground...
Exercise: Add Comments
Add a comment explaining what each line does:
Loading JavaScript Exercise...
Exercise: Disable Code
Use comments to prevent the middle line from running:
Loading JavaScript Exercise...
Up next · Lesson 4 of 37
Variables (let, const, var)
1 min read
3 of 37 lessons done

Ask Byte about this lesson
A private chat about this lesson. Byte has read the whole lesson, answers in seconds, and shows the section each answer comes from. Ask follow-ups in any language.
Questions & Answers
Public questions about this lesson. The AI Tutor answers right away in your language, the FreeAcademy team checks answers, and every learner can read them.

