Javascript comments
We usually use JavaScript comments for explaining JavaScript code and making it more readable. They also can be used to prevent execution during testing alternative code.
<script type="text/javascript"></script>
But we don’t use this method in modern JavaScript, because this kind of comments hides JavaScript code from old browsers. On the other hand, they can help you identify a really old code.
There are exists two types of comments: single-line comments and multi-line comments. The example which you see here uses a single-line comment before each code line:
// javascript comments: welcome to w3Docs
<script>
// console.log('Welcome to web!');
</script>
We use single-line comments for writing small notes. You just need to add // before your code or text. Note that any kind of text between // and the end of the line will be ignored by JavaScript.
As concerns multi-line comments, there are long segments of code that we used to disable. You need to add /* before your code and */ after it. Start with /* and end with */. Remember, that any text between /* and */ will be ignored by JavaScript.
<!DOCTYPE HTML>
<HTML>
<head>
</head>
<body>
/* javascript comments:
welcome to W3Docs
*/
<script>
/* console.log('Welcome to web!');
alert("Welcome to web"); */
</script>
</body>
</html>
0 Comments
CAN FEEDBACK
Emoji