From 0a5db0d02ade12f2c9d66627796732e2af1c5c29 Mon Sep 17 00:00:00 2001 From: ruanyf Date: Sun, 26 May 2019 20:41:20 +0800 Subject: [PATCH] docs(string-methods): edit --- docs/string-methods.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/docs/string-methods.md b/docs/string-methods.md index 0d5f4cd..863e942 100644 --- a/docs/string-methods.md +++ b/docs/string-methods.md @@ -123,16 +123,17 @@ for (let ch of s) { // 61 ``` -或者使用 `Spread` 展开运算 +另一种方法也可以,使用扩展运算符(`...`)进行展开运算。 ```javascript let arr = [...'𠮷a']; // arr.length === 2 -arr.forEach(ch => console.log(ch.codePointAt(0).toString(16))); +arr.forEach( + ch => console.log(ch.codePointAt(0).toString(16)) +); // 20bb7 // 61 ``` - `codePointAt()`方法是测试一个字符由两个字节还是由四个字节组成的最简单方法。 ```javascript