freeCodeCamp/guide/chinese/certifications/javascript-algorithms-and-d.../debugging/catch-mixed-usage-of-single.../index.md

512 B

title localeTitle
Catch Mixed Usage of Single and Double Quotes 抓住单引号和双引号的混合使用

抓住单引号和双引号的混合使用

  • 请记住,您是选择使用单引号还是双引号,只需在字符前添加\即可使字符适合字符串而不关闭单引号或双引号。
  • 测试用例只能使用双引号传递。

解:

//Solution1: 
 let innerHtml = "<p>Click here to <a href=\"#Home\">return home</a></p>"; 
 console.log(innerHtml);