Syntax and Parsing Mechanics
A single-line comment is initiated by the double forward-slash token (//). The JavaScript engine ignores all characters following this token up to the next LineTerminator (such as a line feed \n, carriage return \r, line separator \u2028, or paragraph separator \u2029).
Placement
Single-line comments can be declared as standalone lines or appended to the end of a valid JavaScript statement. When appended inline, the parser evaluates the preceding code and ignores everything from the// token onward.
Lexical Boundaries
Because the single-line comment is strictly terminated by aLineTerminator, it cannot span multiple lines. Any text on a subsequent line is treated as standard executable code by the engine unless it is preceded by another // token.
// token is placed inside a string literal or a regular expression, it is evaluated as standard character data rather than a comment initiator.
Tired of Poor JavaScript Skills? Fix That With Deep Grasping!Learn More





