In this example, I have shared how to write comments in JavaScript with example. There are two ways to write comments in JavaScript:
1 2 3 4 5 | <script> function helloWorld(){ alert("Hello World!"); // alert "Hello World!" in the browser } </script> |
JavaScript multiple line comment begins with /*, and ends with */.
1 2 3 4 5 6 7 8 9 | <script> /* The function below display an alert dialog with "Hello World!" message */ function helloWorld(){ alert("Hello World!"); } </script> |
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.