In JavaScript, there are two methods for commenting out the code: Single line comment – A single-line comment is one that will only produce one line of text. Add double forward slashes // at the beginning of the JavaScript code to do this. JavaScript ignores any code between // and the end of the statement. Multiple line comment – When you want to comment out a big line of code or add extra information so that others understand what your code does or why it’s used, you use a multiple-line comment.