forEach不是JavaScript数组的函数错误

JavaScript

Green斯丁

2020-03-09

我试图做一个简单的循环:

const parent = this.el.parentElement
console.log(parent.children)
parent.children.forEach(child => {
  console.log(child)
})

但我收到以下错误:

VM384:53未捕获的TypeError:parent.children.forEach不是一个函数

即使parent.children日志:

在此处输入图片说明

可能是什么问题呢?

注意:这是一个JSFiddle

第374篇《forEach不是JavaScript数组的函数错误》来自Winter(https://github.com/aiyld/aiyld.github.io)的站点

0个回答

问题类别

JavaScript Ckeditor Python Webpack TypeScript Vue.js React.js ExpressJS KoaJS CSS Node.js HTML Django 单元测试 PHP Asp.net jQuery Bootstrap IOS Android