" in javascript I saw this tag used after javascript functions for over ten years and never asked WHY. This can be seen in most o...">

Why use "// ->" in javascript

I saw this tag used after javascript functions for over ten years and never asked WHY. This can be seen in most of the tutorials I've seen during this time, but I usually leave it ... it does not seem to have any effect anyway. Can someone enlighten me why this is used?

If this simply means the end of the javascript function, would there be a suitable curly brace? If a script tag is used for some functions.

I doubt I need an example, but for all the other readers who are also wondering why here, here is the code:



function helloWorld() {
   document.write('Hello World');
}
//-->

Thanks in advance!

+3
source share
6 answers

javascript, , , javascript HTML ".

XHTML , script,

<script type="text/javascript">
<![CDATA[
... unescaped script content ...
]]>
</script>

HTML. . :

http://www.w3.org/TR/xhtml1/
http://www.w3schools.com/tags/tag_script.asp
+4

, JS . JS- HTML, HTML (<!-- -->) , . // --> , , JS, HTML JS-.

+10
+3

, <!-- .

, , Javascript, .

, html , <!-- -->,

+1

, html-, js html-. , , . javascript, , ,

+1
  • , JavaScript, JavaScript , start <!-- end html_comment_tags --> bad_data script > / ? < & ^ % # ) ! - (
  • javascripts, comment_ending --> - //, html_comment_end -->, // javascript ( , jscript ), , , --> <script></script>, //
+1

Source: https://habr.com/ru/post/1757342/


All Articles