类型错误:无法调用未定义的方法“forEach”
TypeError: cannot call method 'forEach' of undefined
当我尝试将静态目录添加到我的代码中时,出现此错误:
TypeError: cannot call method 'forEach' of undefined
谁能帮我解决这个问题?
['adobeair','applewebkit','bs3','chrome','css','font-awesome','hpwos','images','img','js', 'Opera', 'plugins'].forEach(function (dir)
{
app.use('/template/'+dir, connect.static(__dirname+'/template/'+dir));
});
谢谢
最好的方式 -
var dirs = ['adobeair','applewebkit','bs3','chrome','css','font-awesome','hpwos','images','img','js', 'Opera', 'plugins'];
dirs.forEach(function(dir) {
console.log('dir name : '+dir);
});
它正在工作或我:)
相关文章:
- 在JavaScript中中断forEach方法的首选方法
- 将id/类放在HTML中的正确方法是使用foreach来获得确切的值
- 不能调用未定义节点.js的方法“forEach”
- 每次迭代在 Foreach 循环中重复 PHP 睡眠方法
- 如何删除“对象在节点中没有方法'forEach'错误.js”
- 使用 forEach 方法修改 dom 元素
- JavaScript 方法 array.forEach 在 Chrome 中工作吗?
- MongoDB aggregate() - 错误“TypeError: 无法调用未定义的方法'forEach
- 不理解此forEach()方法的输出
- 使用敲除foreach绑定绑定方法名称
- 回调函数的定义以及它如何适用于array.prototype.forEach/map/filter方法
- Jquery.ech()和Array.prototype.forEach()方法的区别
- 如何在knockout.js中的foreach中使用computed方法
- 使用Array.prototype.forEach()方法
- 在Foreach循环中调用Async方法
- JavaScript: Internet Explorer不支持forEach方法
- AngularJS: forEach http get data -等待其他方法,直到所有来自循环的数据被加载
- 为什么字符串变量可以通过JS中的调用使用forEach方法
- node.js:如何在forEach循环中实现一个带有异步调用的路由方法
- 类型错误:无法调用未定义的方法“forEach”