Commenting JavaScript Code

There are two ways to comment JavaScript code. If only one line of code needs to be commented, use two consecutive forward slashes:

//This is a JavaScript single-line code comment

To comment a block of code, do the following:

/*
This is a JavaScript
code block comment
*/

Leave a Reply