If comments are safe, then why doesn't `x = 0; x+/*cmt*/+;` or `var f/*cmt*/oo = 'foo';` work?
问题 This thread inspired the question. Here are the code samples again. I'm looking for an answer that tells exactly what is going on. Both x = 0; x+/*cmt*/+; and var f/*cmt*/oo = 'foo'; produce syntax errors, which renders the answers in this question wrong. 回答1: From ECMAScript reference : Comments behave like white space and are discarded except that, if a MultiLineComment contains a line terminator character, then the entire comment is considered to be a LineTerminator for purposes of parsing