|
@@ -0,0 +1,36 @@
|
|
|
+/**
|
|
|
+ * 扩展运算符(...) spread
|
|
|
+ */
|
|
|
+
|
|
|
+var arr = [1,2,3,4,5,6];
|
|
|
+var b = [...arr];
|
|
|
+b[0] = 8;
|
|
|
+console.log(arr,'arr');
|
|
|
+console.log(b,'b');
|
|
|
+
|
|
|
+var a = [1,2,3];
|
|
|
+console.log(...a,'...a');
|
|
|
+var b = [2,3,4];
|
|
|
+var c = [...a,...b];
|
|
|
+// var c = a.concat(b);
|
|
|
+console.log(c,'c');
|
|
|
+
|
|
|
+// 类数组
|
|
|
+/**
|
|
|
+ *1.JavaScript 常见的类数组:arguments
|
|
|
+ *2.获取Dom元素方法返回的结果(比如getElementsByTagName,getElementsByClassName,querySelectAll)
|
|
|
+ */
|
|
|
+// function fun1() {
|
|
|
+// console.log(arguments,'类')
|
|
|
+// }
|
|
|
+// fun1(1,2,3,4,5)
|
|
|
+// fun1(arr,'arr')
|
|
|
+let a1 = document.querySelectorAll("ul li");
|
|
|
+console.log(a1,'a1')
|
|
|
+
|
|
|
+// 将类数组 转成数组
|
|
|
+let news = [...a1];
|
|
|
+console.log(news,'news');
|
|
|
+
|
|
|
+news.push(121);
|
|
|
+console.log(news,'news');
|