当前位置:网站首页>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 .
边栏推荐
- Network parameter management
- Ways to improve the utilization of openeuler resources 01: Introduction
- leetcode hot 100(刷题篇8)(232/88/451/offer10/offer22/344/)
- Jump statements break and continue
- 俄罗斯方块、1
- Hcip day 9 notes (OSPF routing feedback, routing policy, and Configuration Guide)
- MySQL learning - MySQL software installation and environment configuration (Windows) details!
- JS 数组 isAarray() typeof
- MySql的DDL和DML和DQL的基本语法
- 1. Learn to understand web pages
猜你喜欢

Services et configurations FTP

Error code 0x80004005

QT custom class uses custom parametric signals and slots

How to realize WiFi Internet short message authentication in the park / factory

Keras deep learning practice (15) -- realize Yolo target detection from scratch

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

JS Array isaarray () Type of

Secondary development of ArcGIS JS API -- loading national sky map

A simple and perfect WPF management system framework source code

Paper reading: the perfect match: 3D point cloud matching with smoothed densities
随机推荐
Rpc-bdy (5) - automatic service logoff, load balancing
Gpushare.com | 如何使用TensorBoardX可视化工具?
JIRA automation experience sharing for 2 years
08 reptile project
Tetris, 1
FTP服務與配置
Regular expression \b \b understand word boundary matching in simple terms
It's solved with a cry
Basic use of Pinia
Realize the communication before two pages (using localstorage)
Microsoft win11/10 package manager Winget will support the installation of applications from zip files
Svn: e00002: can't convert string from 'UTF-8' to native encoding problem solving
IDEA Clone的项目报Cannot resolve symbol ‘Override‘
Binary search
二分查找
1. Learn to understand web pages
正则表达式 \b \B 深入浅出理解单词边界的匹配
How will you answer the "Hello world" challenge written in C language?
SolidWorks cannot reference references
Binary tree traversal