[Solved] about javascript comment specification


This happens because <!-- behaves similar to //, i.e. it comments out only everything after it on the same line. JS doesn’t recognize the closing part of the HTML’s comment block (-->). Looks like you even know this, since you’ve commented it out in your snippet.

Originally this commenting method was used to hide a script from browsers, which didn’t support JS and script tags. Instead they showed the content of script tag on a page, and a HTML comment was needed to prevent script text to shown on a page.

1

solved about javascript comment specification