Comments in JavaScript
Comments are lines in your code that JavaScript ignores when running the program. They are used to explain what the code does, making it easier to understand later – for yourself or for others reading your code.
Good comments improve code readability and help with debugging and collaboration.
Single-Line Comments
Use // for comments on a single line. Everything after // on that line is ignored.
Multi-Line (Block) Comments
Use /* to start and */ to end a comment that can span multiple lines.
When to Use Comments
- Explain complex logic.
- Document functions or variables.
- Temporarily disable code during testing (comment out lines).
- Add notes for future improvements.
Avoid over-commenting obvious code – write clear code instead.
Practical Example
Quick Quiz
Az anyagokat átnéztük és ellenőriztük, de hibák továbbra is előfordulhatnak. A tartalom kizárólag oktatási célt szolgál, ezért saját felelősségre használd, és szükség esetén ellenőrizd más forrásokkal is.
✨ Kérdezd Larát — a tanulási partnered
Fedezd fel a személyre szabott tanulási támogatást. Lara elmagyarázza az anyagot, összefoglalja a témákat és megválaszolja a kérdéseidet — az Go csomagtól elérhető.
Lara segít gyorsabban tanulni — kizárólag a ReadyTools Go, Plus és Max tagoknak.


