JavaScript Comment | Single & Multi Line – Letstacle

JavaScript Comment | Single & Multi Line – Letstacle 0 HomeLive Programming HelpComputer Science Homework HelpPython Homework HelpPython Homework SolvedJava Homework HelpJava Homework solvedC++ Homework HelpR Homework HelpPHP Homework HelpHTML Homework HelpJavaScript Homework HelpSQL Homework HelpDo My Programming HomeworkAndroid Assignment HelpAboutHow it WorksCareersArticlesJavaJavaScriptPythonC++hackerrank solutionsHTMLMathsDatabase AcademyPython Tutor ReviewsRecent ReviewsLeave a Review PaymentFAQs Contact / Get Help JavaScript Comment | Single & Multi Line August 7, 2021 0 Comments Looking for JavaScript comment?Being a programmer it is crucial that you keep track of code blocks and their various sections. Moreover, it’s a good practice to document the work.Not only it helps you to understand. But also give a meaningful explanation to other developers, who might work on the same project.JavaScript or any other programming language comments are used everywhere.Types of Comment in JavaScriptThere are two types of comments used in JavaScript-Single line comment in JavaScriptAnd Multi-line commentSingle line Comment in JavaScriptA single line comment in JavaScript is denoted by a double slash //If you add // to the beginning, the whole line is treated as a comment. Please note that comments are not executed by JavaScript.Thus, anything after // is ignored ( single line only). // Display a message: let message = “Hi this is JavaScript”; //Assign a message console.log(message); //Display it on console By convention, a line starting with  // acts as a header. And it is often added at the end of a line to explain the line of code.This is how we comment out in JavaScript.Multi-line Comments in JavaScriptJavaScript also supports multi-line comments.To add multi-line comments in javascript you need to use /* at the start and */ at the end. Anything in between /* and */ is treated as a comment and will be ignored by JS engines. /* Hi this is a JavaScript program to help you understand multi-line comments. See the code below */ let x=1; let y=2; let sum= x+y; console.log(sum); /* let message = “Welcome to Letstacle.com”; //Assign a message console.log(message); //Display it on console */ Multi-line comments are used mainly to comment out a block of code at one go. It is also used to document a paragraph by including a more detailed explanation.Note: We have used multi-line comments in the above example to exclude the execution of a code block. See lines 12 to 14 as a reference.Other use of JavaScript CommentProgrammers also use comments to quickly debug and do temporary bug fixes. Allowing not to delete the existing line/block of code but to simply comment it out.Certainly, comments play an important role.That’s all about JavaScript comments. Also, You may be interested to learn how to link JavaScript to HTML.Like this article? Follow us on Facebook and LinkedIn. You can also subscribe to our weekly FeedShare Article: Tags:add a comments in JavaScript how to August 4, 2021Check for Duplicates in Array JavaScript August 7, 2021How to Reverse an Array in JavaScript? Leave a Reply Cancel replyLog In Related Articles September 17, 2021JavaScript | Function not defined September 14, 2021JavaScript | Array Length September 8, 2021JavaScript | Get Last Element of Array September 7, 2021JavaScript Clear Array | 3 Ways to Empty Array August 22, 2021JavaScript Square Root | Usage, Syntax & Program March 17, 2022How to Run JavaScript in Visual Studio Code? CategoriesBlog C++ Commerce Help Database Do my Economics Help hackerrank solutions HTML Java JavaScript Java solved Maths Maths Help Node JS Online Tutor Programming Help Python Python solved Quiz Uncategorized Recent Comments On LetstacleJimenez on Computer Science Homework Help | Computer Science HelpLetstacle Team on Python Homework Help | Help with Python HomeworkLetstacle Team on Python Homework Help | Help with Python HomeworkLetstacle Team on Python Homework Help | Help with Python HomeworkLetstacle Team on Python Homework Help | Help with Python HomeworkImler Miller on Python Homework Help | Help with Python HomeworkFeatured posts April 28, 2022Visual Basic Homework Help | VB.net Coding Help April 28, 2022Computer Science Homework Help | Computer Science Help February 15, 2022Do my Java Homework | Get Java Homework Help OnlineCategoriesBlog C++ Commerce Help Database Do my Economics Help hackerrank solutions HTML Java JavaScript Java solved Maths Maths Help Node JS Online Tutor Programming Help Python Python solved Quiz UncategorizedQuick LinksMake PaymentLeave a ReviewStoreTop Rated Rated 4.9 out of 5 Made with <3 creative team @ 2021 Letstacle.comTerms of Use | Disclaimer | Privacy Policy

Leave a comment

Your email address will not be published.