0

Some older(?) Javascript sometimes includes <!-- ... //--> like

<script>
    <!--
    var text1="bla";
    var text2="bla";
    //-->
</script>

What does that do? Comment out? Why?

And do you still use that today?

Toto
  • 89,455
  • 62
  • 89
  • 125
Marc
  • 91
  • 1
  • 6
  • Its like a comment section for html. – Grumpy Jun 01 '21 at 08:25
  • Your answer is [here](https://stackoverflow.com/questions/5780047/html-comments-in-a-javascript-block) – TechySharnav Jun 01 '21 at 08:26
  • [HTML Comments](https://developer.mozilla.org/en-US/docs/Learn/HTML/Introduction_to_HTML/Getting_started#html_comments) on MDN Web Docs. – Tanner Dolby Jun 01 '21 at 08:27
  • Duplicate to: https://stackoverflow.com/questions/30130324/what-does-in-html-mean/30131015 – Amit Mondal Jun 01 '21 at 08:27
  • @AmitMondal While the question you linked to is definitely related, this question is not a duplicate of that one because this question specifically addresses the (outdated) use of HTML-style syntax for comments **in a JavaScript context**. (This question is now marked as a duplicate of another question, which does deal specifically with this same issue.) – Cat Jun 01 '21 at 08:42

1 Answers1

1

It is used to comment out lines in html similar to "text"/'''text''' in python or // in a few other languages. Commenting a line will not process/execute it.

sushruth P
  • 26
  • 1