【发布时间】:2021-07-06 08:47:12
【问题描述】:
我在 JS/Lodash 中有一个练习,以每首 5 秒的延迟打印十首歌曲。问题是,我得到这首歌的 10 倍,那个指数是第 14 位。 我不知道我在哪里犯了错误,如果有任何帮助,将不胜感激。
const utwory = [{
"author": "Queen",
"song": "Bohemian Rhapsody",
"place": 1,
"change": 0
},
{
"author": "Deep Purple",
"song": "Child in time",
"place": 2,
"change": 2
}
]
function ex7() {
let i = 0;
while (i < 10) {
_.delay(function(arr) {
console.log(arr[i].author + " " + arr[i].song)
}, 10000, utwory)
i += 1
}
}
ex7()
【问题讨论】:
标签: javascript functional-programming lodash yarnpkg