Skip to content
doubtly

2 answers

Answer: // for single-line comments and /* … */ for multi-line comments.

// This is a single-line comment
let x = 10;  // comment after code

/* This is a
   multi-line comment */
let y = 20;

Everything after // on that line is ignored by the browser. Everything between /* and */ is ignored, even across several lines. Multi-line comments cannot be nested. Comments are used to explain code or to temporarily disable a line while testing.

Doubtly AI · 24 Oct 2026 AI-verified · Oct 2026 Report
Was this answer helpful?

Your answer

Log in or create a free account to answer this question.