console.log("double"); vs console.log(‘single‘); 不应该以编码风格为重点, 而应该以引号内的内容为重点, 比如以下 alert(‘Say "Hello"‘); alert("Say ‘Hello‘"); 更复杂的 alert("It‘s \"game\" time."); alert(‘It\‘s "game" time.‘); ES6更喜欢用反斜杠 alert(`Use "double" and ‘single‘ quotes in the same string`); alert(`The escape the \` back-tick character in a string`); 比如 `\`` === "`" // --> true console.log("string text line 1\n"+ "string text line 2"); // "string text line 1 // string text line 2"
时间: 2024-11-10 16:06:51