2 min read
Comments
A comment is a note in the code that JavaScript ignores completely — it's for humans reading the code, not the computer.
// A single-line comment
/*
* A multi-line comment,
* spanning several lines.
*/
const total = price * 1.08; // apply 8% tax
Use comments to explain why something non-obvious is done, not to restate what the code already says clearly.