Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 286
Sungguk Lim Avatar asked Mar 17 '10 10:03

Sungguk Lim


People also ask

What is JavaScript and how to learn it?

JavaScript is one of the 3 languages all web developers must learn: 1 HTML to define the content of web pages 2 CSS to specify the layout of web pages 3 JavaScript to program the behavior of web pages More ...

Is JavaScript a good first programming language?

Compared to many other programming languages, JavaScript offers one of the more beginner-friendly entry points into the world of coding. The great thing about it is that it comes installed on every modern web browser —there’s no need to set up any kind of development environment, which means you can start coding with JavaScript right away!

Do I have to get or download JavaScript?

You don't have to get or download JavaScript. JavaScript is already running in your browser on your computer, on your tablet, and on your smart-phone. JavaScript is free to use for everyone. W3Schools maintains a complete JavaScript reference, including all HTML and browser objects.

Is it possible to use JavaScript in VS Code?

However, these are currently not supported by VS Code's JavaScript language service and are flagged as errors. For users who still want to use these future features, we provide the javascript.validate.enable setting.


1 Answers

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.

like image 121
Quentin Avatar answered Sep 27 '22 21:09

Quentin