Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update basic.md #15

Open
wants to merge 1 commit into
base: gh-pages
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion grammar/basic.md
Original file line number Diff line number Diff line change
Expand Up @@ -630,7 +630,7 @@ s.length // 2

{% endhighlight %}

上面代码说明,对于于U+10000到U+10FFFF之间的字符,JavaScript总是视为两个字符(字符串长度为2),所以处理的时候,必须把这一点考虑在内。假定C是字符的Unicode编号,H是对应的UTF-16的前两个字节,F是对应的UTF-16的后两个字节,则它们之间的换算关系如下:
上面代码说明,对于于U+10000到U+10FFFF之间的字符,JavaScript总是视为两个字符(字符串长度为2),所以处理的时候,必须把这一点考虑在内。假定C是字符的Unicode编号,H是对应的UTF-16的前两个字节,L是对应的UTF-16的后两个字节,则它们之间的换算关系如下:

{% highlight javascript %}

Expand Down