From 4c0e3018a38441b3913b7cdd7189e0f101339431 Mon Sep 17 00:00:00 2001 From: heibaiying <31504331+heibaiying@users.noreply.github.com> Date: Sat, 14 Sep 2019 11:27:23 +0800 Subject: [PATCH] =?UTF-8?q?Update=20JavaScript=5F=E5=9F=BA=E7=A1=80.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- notes/JavaScript_基础.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/notes/JavaScript_基础.md b/notes/JavaScript_基础.md index d03e4d8..d02089d 100644 --- a/notes/JavaScript_基础.md +++ b/notes/JavaScript_基础.md @@ -86,14 +86,14 @@ alert(stringValue.substring(3,7)); // "lo w" alert(stringValue.substr(3, 7)); // "lo worl" // 当第一个参数为负值时 -alert(stringValue.slice(-3)); // "rld" 按照规则等价于: slice(8) -alert(stringValue.substring(-3)); // "hello world" 按照规则等价于: substring(0) -alert(stringValue.substr(-3)); // "rld" 按照规则等价于: substr(8) +alert(stringValue.slice(-3)); // "rld" 按照规则等价于: slice(8) +alert(stringValue.substring(-3)); // "hello world" 按照规则等价于: substring(0) +alert(stringValue.substr(-3)); // "rld" 按照规则等价于: substr(8) // 当第二个参数为负值时 -alert(stringValue.slice(3, -4)); // "lo w" 按照规则等价于: slice(3,7) -alert(stringValue.substring(3, -4)); // "hel" 按照规则等价于: substring(3,0) -alert(stringValue.substr(3, -4)); // ""(空字符串) 按照规则等价于: substr(3,0) +alert(stringValue.slice(3, -4)); // "lo w" 按照规则等价于: slice(3,7) +alert(stringValue.substring(3, -4)); // "hel" 按照规则等价于: substring(3,0) +alert(stringValue.substr(3, -4)); // ""(空字符串) 按照规则等价于: substr(3,0) ```