Wrapping javascript in <!— -->

前端 未结 6 1025
慢半拍i
慢半拍i 2021-02-13 02:15

What\'s the point of wrapping javascript code in ?

6条回答
  •  轮回少年
    2021-02-13 03:03

    Apart from some browsers possibly not supporting it there is another reason: the W3C XHTML validator (http://validator.w3.org) interprets JavaScript that is not in comment tags as if it were HTML. So something like "i < 0" will mean your website doesn't validate unless you use these tags.

提交回复
热议问题