标签:title unshift har 添加元素 htm pre doc log rip
<!DOCTYPE html> <html> <head lang="en"> <meta charset="UTF-8"> <title></title> </head> <body> <script> var arr = ["关羽","张飞","刘备"]; var arr2 = [1,2,3] console.log(arr); // //在数组的最末尾添加元素(返回新数组的长度) // var aaa = arr.push("abc"); //// var aaa = arr.push("abc","def"); //// var aaa = arr.push(arr2); // console.log(aaa); // console.log(arr); // // //在数组的最末尾删除一个元素(返回新被删除的元素) // aaa = arr.pop(); // console.log(aaa); // console.log(arr); //unshift在数组的最前面添加元素 aaa = arr.unshift("abc"); console.log(aaa); console.log(arr); aaa = arr.shift(); console.log(aaa); console.log(arr); </script> </body> </html>
标签:title unshift har 添加元素 htm pre doc log rip
原文地址:http://www.cnblogs.com/sj1988/p/6579788.html