Comments Table of ContentsIntroductionSingle Line CommentsMulti-line CommentsIntroductionJavaScript comments can be used to explain JavaScript code, and to make it more readable JavaScript comments can also be used to prevent execution, when testing alternative code. There are 2 types of commentsSingle Line CommentsMulti Line CommentsFor your kind informationIt is most common to use single line comments. Block comments are often used for formal documentationSingle Line CommentsSingle line comments start with // Any text between // and the end of the line will be ignored by JavaScript (will not be executed).//var name="Zeny Gupta";Single line comment also use at the end of each line to explain the code.var firstNumber = 50; // Declare firstNumber, and assign 50 var secondNumber 40; // Declare secondNumber, and assign 40 // Declare sum and assign sum of firstNumber and secondNumber var sum = firstNumber + secondNumber;Multi-line CommentsMulti-line comments start with / and end with /.Any text between /” and “/ will be ignored by JavaScript./* Declare firstNumber, give it the value of 50 Declare secondNumber, give it the value of 40. Declare sum and assign sum of firstNumber and second Number. */ var firstNumber = 50; var secondNumber = 40; var total= firstNumber + secondNumber;You may likeDoc navigation← Formatting and Coding ConventionsEmbedding JavaScript in HTML → Was this article helpful to you? Yes No How can we help? Name Email subject message Leave a Reply Cancel replyYour email address will not be published. Required fields are marked *Comment * Δ