From e6682ab2c38904dd8285717495b25e9d80cfdceb Mon Sep 17 00:00:00 2001 From: heibaiying <31504331+heibaiying@users.noreply.github.com> Date: Sat, 14 Sep 2019 11:25:35 +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 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/notes/JavaScript_基础.md b/notes/JavaScript_基础.md index f2135a0..d03e4d8 100644 --- a/notes/JavaScript_基础.md +++ b/notes/JavaScript_基础.md @@ -87,7 +87,7 @@ alert(stringValue.substr(3, 7)); // "lo worl" // 当第一个参数为负值时 alert(stringValue.slice(-3)); // "rld" 按照规则等价于: slice(8) -alert(stringValue.substring(-3)); // "hello world" 按照规则等价于: substring(0) +alert(stringValue.substring(-3)); // "hello world" 按照规则等价于: substring(0) alert(stringValue.substr(-3)); // "rld" 按照规则等价于: substr(8) // 当第二个参数为负值时 @@ -237,7 +237,7 @@ var colors = ["red", "blue", "green"]; var colors = ["red", "blue", "green"]; colors.length = 2; // ["red", "blue"] -colors[colors.length] = "green"; // ["red", "blue", "green"] +colors[colors.length] = "green"; // ["red", "blue", "green"] colors[10] = "black"; // ["red", "blue", "green", empty × 7, "black"] ``` @@ -269,8 +269,8 @@ ECMAScript 的数组提供了类似栈的特性,能够实现后进先出: var colors = ["red", "blue", "green"]; colors.push("black"); // ["red", "blue", "green", "black"] -colors.pop() // "black" -colors // ["red", "blue", "green"] +colors.pop() // "black" +colors // ["red", "blue", "green"] ``` **4. 队列方法**