Skip to content

Instantly share code, notes, and snippets.

@cornedor
Last active August 29, 2015 14:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cornedor/6ba3e78c554bccde1cf8 to your computer and use it in GitHub Desktop.
Save cornedor/6ba3e78c554bccde1cf8 to your computer and use it in GitHub Desktop.
Using "-->" as a single line comment.

Using "-->" as a single line comment.

Typing --> on the beginning of a line of code in JavaScript seems to comment it. But looks like there isn't almost no info available about this.

What i found so far is a v8 (test)[https://github.com/crosswalk-project/v8-crosswalk/blob/master/test/webkit/parser-xml-close-comment.js] that does test for this feature. So it looks like it is done intentionally.

Looks like v8 and Firefox's JS engine do both parse this correctly. MuJS does throw an syntax error

SyntaxError: test.js:2: unexpected token in expression: '>'
        [C]: in function '?'

http://people.mozilla.org/~jorendorff/es6-draft.html#sec-html-like-comments

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment