--- id: 587d7b84367417b2b2512b37 title: Catch Mixed Usage of Single and Double Quotes challengeType: 1 videoUrl: '' localeTitle: 抓住单引号和双引号的混合使用 --- ## Description
JavaScript允许使用单个(“)和双(”“)引号来声明一个字符串。决定使用哪一个通常归结为个人偏好,但有一些例外。当字符串有收缩或另一个时,有两个选择很好引号中的文本片段。请注意,不要过早关闭字符串,这会导致语法错误。以下是混合引号的一些示例:
//这些是正确的:
const grouchoContraction =“我度过了一个美好的夜晚,但事实并非如此。”;
const quoteInString =“Groucho Marx曾经说过'引用我的话说我被误引了'。”;
//这是不正确的:
const uhOhGroucho ='我度过了一个美妙的夜晚,但这不是它。';
当然,只使用一种报价样式是可以的。您可以使用反斜杠(\)转义字符来转义字符串中的引号:
//正确使用相同的引号:
const allSameQuotes ='我度过了一个非常精彩的夜晚,但这不是它。';
## Instructions
修复字符串,使其对href值使用不同的引号,或者转义现有的引号。在整个字符串周围保留双引号。
## Tests
```yml tests: - text: '您的代码应该通过更改或转义它们来修复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.");' ```

## Challenge Seed
```js let innerHtml = "

Click here to return home

"; console.log(innerHtml); ```
## Solution
```js // solution required ```