//这些是正确的:当然,只使用一种报价样式是可以的。您可以使用反斜杠(\)转义字符来转义字符串中的引号:
const grouchoContraction =“我度过了一个美好的夜晚,但事实并非如此。”;
const quoteInString =“Groucho Marx曾经说过'引用我的话说我被误引了'。”;
//这是不正确的:
const uhOhGroucho ='我度过了一个美妙的夜晚,但这不是它。';
//正确使用相同的引号:
const allSameQuotes ='我度过了一个非常精彩的夜晚,但这不是它。';
href
值使用不同的引号,或者转义现有的引号。在整个字符串周围保留双引号。 href
值“#Home”周围的引号。'
testString: 'assert(code.match(//g), "Your code should fix the quotes around the href
value "#Home" by either changing or escaping them.");'
- text: 您的代码应该在整个字符串周围保留双引号。
testString: 'assert(code.match(/".*?<\/p>";/g), "Your code should keep the double quotes around the entire string.");' ```
Click here to return home
"; console.log(innerHtml); ```