I am newbie.
many of javascript code start with <!--
<script type="text/javascript">
<!--
and finish with //-->
//-->
</script>
I think the reason is for patibility.
But I cannot find the clue in any books.
even I cannot find anything with google.
I am newbie.
many of javascript code start with <!--
<script type="text/javascript">
<!--
and finish with //-->
//-->
</script>
I think the reason is for patibility.
But I cannot find the clue in any books.
even I cannot find anything with google.
Share Improve this question edited Jun 4, 2010 at 4:04 Jon Seigel 12.4k8 gold badges60 silver badges93 bronze badges asked Mar 17, 2010 at 10:14 Sungguk LimSungguk Lim 6,2287 gold badges45 silver badges64 bronze badges 1- Sorry about my horrible English. – Sungguk Lim Commented Mar 17, 2010 at 10:15
3 Answers
Reset to default 15No. This is a holdover from the days when Netscape 2 was mon.
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.
No, Javascript can run perfectly fine without them.
The reason was to hide JavaScript from any browser that doesn't know how to handle it. Those browsers used to display the code to the user. Hence, a way to hide code from those browsers was introduced. As there aren't any browsers around that don't know about JavaScript nowadays, it's mainly a remainder from the good ol' days :)