我在涉及forEach方法的这个问题上遇到了困难。 我尝试了我能想到的所有编写代码的方式,但问题1每次都是错误的。
function exerciseOne(names){
// Exercise One: In this exercise you will be given and array called names.
// Using the forEach method and a callback as it's only argument, console log
// each of the names.
}
// MY CODE:
function logNames(name){
console.log(name);
}
names.forEach(logNames);
names.forEach(function(item) { console.log(item); })
- j08691exerciseOne()
方法内部实现逻辑。 - Shidersz