Javascript \u003C 是什么意思?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4858494/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-23 14:26:38  来源:igfitidea点击:

What does \u003C mean?

javascript

提问by Blankman

I'm looking at twitter's javascript file, and I see this in the templates hash:

我正在查看 twitter 的 javascript 文件,我在模板哈希中看到了这一点:

Browse Interests{{/i}}\u003C/a\u003E\n        \u003C/li\u003E\n  {{#logged_in}}\n

What do those codes represent?

这些代码代表什么?

回答by Raynos

It's a unicode character. In this case \u003Cand \u003Emean :

这是一个Unicode字符。在这种情况下\u003C\u003E意思是:

U+003C < Less-than sign

U+003E > Greater-than sign

U+003C < 小于号

U+003E > 大于号

See a list here

在此处查看列表

回答by jhartz

That is a unicode character code that, when parsed by JavaScript as a string, is converted into its corresponding character (JavaScript automatically converts any occurrences of \uXXXXinto the corresponding Unicode character). For example, your example would be:

这是一个 unicode 字符代码,当被 JavaScript 解析为字符串时,它会被转换为其相应的字符(JavaScript 会自动将任何出现的\uXXXX转换为相应的 Unicode 字符)。例如,您的示例是:

Browse Interests{{/i}}</a>\n        </li>\n  {{#logged_in}}\n

As you can see, \u003Cchanges into <(less-than sign) and \u003Echanges into >(greater-than sign).

如您所见,\u003C变为<(小于号)和\u003E变为>(大于号)。

In addition to the link posted by Raynos, this page from the Unicode websitelists a lot of characters (so many that they decided to annoyingly group them) and this pagehas a (kind of) nice index.

除了 Raynos 发布的链接之外,Unicode 网站的这个页面还列出了很多字符(太多了,以至于他们决定烦人地将它们分组),并且这个页面有一个(某种)不错的索引。

回答by Neil

It is a unicode char \u003C = <

它是一个 Unicode 字符 \u003C = <

回答by amurra

Those are unicode escapes. The general unicode escapes looks like \uxxxxwhere xxxxare the hexadecimal digits of the ASCI characters. They are used mainly to insert special characters inside a javascript string.

这些是unicode转义。一般的 unicode 转义看起来像ASCI 字符的十六进制数字\uxxxx在哪里xxxx。它们主要用于在 javascript 字符串中插入特殊字符。