Lexical syntax

JavaScript line comment

Try the free JavaScript compiler

A line comment continues until a line terminator or the end of source. Its contents are not executed as ordinary code. The delimiter inside a quoted string is not a comment opener.

Formal Syntax & Structure

javascript syntaxjavascript
// comment

Working Example

Example Snippetjavascript
// Explain the next line.console.log(2);
JavaScript Reference