does javascript code need to start with "<!-- "?

html, javascript

Solution

No. This is a holdover from the days when Netscape 2 was common.

It isn't needed with any browser that can function on the web today, and it is positively harmful in XHTML.

I wrote a longer explanation last year.

Problem

I am newbie. many of javascript code start with `<!--` ``` <script type="text/javascript"> <!-- ``` and finish with `//-->` ``` //--> </script> ``` I think the reason is for compatibility. But I cannot find the clue in any books. even I cannot find anything with google.

Original source