JavaScript: Comment

By Xah Lee. Date: . Last updated: .

Single Line Comment

In any position of a line, text starting with 2 slashs // to end of line are ignored. (except if they are inside string)

// this is single line comment
3 + 4; // is 7

Block Comment

And any text between /* and */ are ignored.

/* this is
multi-line
comment. */
3 + 4; /* is 7 */
/* comment cannot be nested
/* error */
*/
BUY Ξ£JS JavaScript in Depth