我目前正在遍历一个数组,即:
contents.map((content) => {
switch(content.type) {
case: 1
console.log("type is one and next type is ..");
case: 2
console.log("type is two")
}
})
如您所见,在案例1中,我需要获取下一个项的类型。我知道可以使用带有i增量的for循环实现,但需要在map内部执行。我愿意尝试使用类似lodash这样的库(在文档中找不到任何信息)。