12345678910111213141516171819202122232425262728293031323334353637 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>Document</title>
- </head>
- <body>
- <ul>
- <li>你好1</li>
- <li>你好2</li>
- <li>你好3</li>
- <li>你好4</li>
- </ul>
- <script>
- /**
- * 类数组:
- * 不能直接使用数组的方法
- * 1.js常见的类数组:arguments(实参);
- * 2.由querySelectorAll,getElementsByClassName,getElementsByTagName
- */
- var arr = [1,2,3,4,5,6,7];
- console.log(arr);
- function fn1(a) {
- console.log(a,arguments)
- }
- fn1(arr);
- let list = document.querySelectorAll("ul li");
- // list.push('9')
- console.log(list);
- //类数组转成整行数组:
- let newsList = [...list];
- newsList.push(0)
- console.log(newsList)
- </script>
- </body>
- </html>
|