JavaScript and forward slashes in strings

前端 未结 3 1958
清酒与你
清酒与你 2020-12-06 06:15

What is the real reason that we must escape a forward slash in a JavaScript string, and also why must we escape string/no string in XHTML. A lot of tutorials just brush ove

3条回答
  •  鱼传尺愫
    2020-12-06 06:45

    The slash is needed to prevent browsers, particularly older ones, to erroneously interpret the forward slash as a closing JavaScript marker.

提交回复
热议问题