What is the purpose of using // in the following code. If old browsers doesnt support javascript then the symbols <!-- --> will ignore js code. In case browsers support JS, these symbols <!-- --> will be ignored. Then wats the use of // symbols.
<html>
<body>
<script type="text/javascript">
<!--
document.getElementById("demo").innerHTML=Date();
//-->
</script>
</body>
</html>
True, assuming HTML and for a definition of “old browsers” equal to “Netscape 1 era”. Don’t use them today.
Only half true. Only the start of the comment is special cased. From the specification: