当前位置:网站首页>Convert the pseudo array returned by childNodes into a true array
Convert the pseudo array returned by childNodes into a true array
2022-07-24 03:29:00 【Laugh and say threethousand】
One , reason
What we got childNodes The return is an array like object , Print it out and you will find . There is no common method of array on its prototype :
console.log("+++++",el.childNodes)
You'll get :
Two , Convert a pseudo array to a true array
const newArr=[].slice.call(el.childNodes)
console.log("====",newArr)
What is called is actually Array.protype Upper slice Method , there call No parameters passed in , So cut from the first item to the last item . Do not change the original pseudo array .
The true array returned after this , Array methods can be used normally .
边栏推荐
- B. Eastern Exhibition- Codeforces Round #703 (Div. 2)
- Is the reverse repurchase of treasury bonds safe? How to open an account online?
- STL set容器
- Connected graph (day 72)
- 93. (leaflet chapter) leaflet situation plotting - modification of attack direction
- Hospital PACS source code PACS ultrasonic Department source code DICOM image workstation source code [source code free sharing]
- 21st day of written test mandatory training
- How emqx 5.0 under the new architecture of mria + rlog realizes 100million mqtt connections
- I developed an app similar to wechat runnable applet with fluent
- C自定义类型详解
猜你喜欢

Talk about the application of FIFO

什么是IMU?

Data Lake: comparative analysis of open source data Lake schemes deltalake, Hudi and iceberg

拉格朗日插值法

Expressions régulières \ \ B \ \ b compréhension de l'appariement des limites des mots

I developed an app similar to wechat runnable applet with fluent

SolidWorks CAM data cannot be recovered because a processed part has been detected.

MySQL sub database and sub table and its smooth expansion scheme

CVE-2022-29464 WSO2文件上传漏洞

Application of motion capture in automatic control field
随机推荐
B. Eastern Exhibition- Codeforces Round #703 (Div. 2)
How to realize WiFi Internet short message authentication in the park / factory
Paper reading: the perfect match: 3D point cloud matching with smoothed densities
轮播图van-swipe的报错:cannot read a properties of null(reading width)
Basic syntax of MySQL DDL and DML and DQL
What is the experience of writing concurrent tool classes (semaphore, cyclicbarrier, countdownlatch) by yourself in line 30?
Web3 traffic aggregation platform starfish OS gives players a new paradigm experience of metauniverse
实现两个页面之前的通信(使用localStorage)
Leetcode Hot 100 (Brush Topic 8) (232 / 88 / 451 / offer10 / offer22 / 344 /)
[wepy2.0] installation
什么是IMU?
Gpushare.com | 如何使用TensorBoardX可视化工具?
What is IMU?
C dynamic memory management details
Industrial controller, do you really know your five insurances and one fund?
FTP服務與配置
4.合宙Air32F103_LCD
How to implement desktop lyrics in pyqt
STL set容器
It's solved with a cry