From 71b13a4351f71fb664b41038fc7a7cf2cc1d142e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=85=94=E5=93=A5?= Date: Wed, 4 May 2016 14:02:22 +0800 Subject: [PATCH] =?UTF-8?q?docs(let):=20=E4=BF=AE=E6=AD=A3=E5=87=BD?= =?UTF-8?q?=E6=95=B0=E9=BB=98=E8=AE=A4=E5=8F=82=E6=95=B0=E7=9A=84=E6=AD=BB?= =?UTF-8?q?=E5=8C=BA=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/let.md | 2 +- docs/string.md | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/let.md b/docs/let.md index 80ad782..e1d4e7c 100644 --- a/docs/let.md +++ b/docs/let.md @@ -133,7 +133,7 @@ function bar(x = y, y = 2) { bar(); // 报错 ``` -上面代码中,调用`bar`函数之所以报错,是因为参数`x`默认值等于另一个参数`y`,而此时`y`还没有声明,属于”死区“。如果`y`的默认值是`x`,就不会报错,因为此时`x`已经声明了。 +上面代码中,调用`bar`函数之所以报错(某些实现可能不报错),是因为参数`x`默认值等于另一个参数`y`,而此时`y`还没有声明,属于”死区“。如果`y`的默认值是`x`,就不会报错,因为此时`x`已经声明了。 ```javascript function bar(x = 2, y = x) { diff --git a/docs/string.md b/docs/string.md index 9db3ac7..48a29a0 100644 --- a/docs/string.md +++ b/docs/string.md @@ -98,8 +98,8 @@ var s = '𠮷a'; for (let ch of s) { console.log(ch.codePointAt(0).toString(16)); } -// "20bb7" -// "" +// 20bb7 +// 61 ``` `codePointAt`方法是测试一个字符由两个字节还是由四个字节组成的最简单方法。