-1

I've been seen some javascript coding enclose with <!-- -->. Is there any significant having it that way?

Code:

<script type="text/javascript" language="javascript">
<!--
      ...javascript code here
-->
</script>

Compared to this:

<script type="text/javascript" language="javascript">

      ...javascript code here

</script>
Stuart
  • 711
  • 1
  • 11
  • 35
  • 4
    http://stackoverflow.com/questions/1507939/using-html-comment-tag-still-relevant-around-javascript-code – Praveen Dec 18 '13 at 07:06
  • You don't need the `language` attribute either. Your sources for this code are pretty old. – Blender Dec 18 '13 at 07:07

2 Answers2

1

They used to be put as a fallback for browsers that didn't support javascript. You might find the answers to this question interesting: Are HTML comments inside script tags a best practice?

Community
  • 1
  • 1
bigblind
  • 12,539
  • 14
  • 68
  • 123
0

Well this is ok to have because you are using javascript in the Html file so the comment using <!----> works only on html file so its fine, but if you was using a external .js file you couldn't use this method of comment because this is the commenting tag for HTML and not javascript.