Well, today I learned that <!-- this --> is syntactically acceptable JavaScript
-
-
It's so you could do <script type="text/javascript"><!-- console.log('hi'); //--></script> and avoid interpreting JS as HTML
-
I always did <script type="text/javascript">//<!-- like some idiot
- 1 more reply
New conversation -
-
-
Back in my day this was best practice ~grumble grumble~
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
It's in Annex B, like much other historical stuff: https://tc39.github.io/ecma262/#sec-html-like-comments …
-
And in fact B.1.3 gives meaning to --> as well: preceded by a newline, it also starts a single line comment. So --> foo is valid JS.
- 1 more reply
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.