JS Script :
<html> <body> <script type="text/javascript"> <!-- document.getElementById("demo").innerHTML=Date(); //--> </script> </body> </html>
Explanation :
- All modern browsers supports JS.
- If any old browser that do not support JavaScript will show JS Script as its page content.
- In order to handle this situation JavaScript Standard provides us easy way of hiding JS code.
- HTML Comment tag is used to hide JS code.
How to Comment Code ?
- Add an HTML comment tag <!- before the first JavaScript statement
- Add a -> (end of comment) after the last JavaScript statement.
- The two forward slashes at the end of comment line (//) is the JavaScript comment symbol.
- This prevents JavaScript from executing the -> tag.