📌  相关文章
📜  如何获取 map() js 中的下一项 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:01:48.787000             🧑  作者: Mango

代码示例1
// The callback of map method accepts 3 arguments:

// current item value;
// current item index;
// the array map was called upon.
// So, you could use index to get next element value:

var newArray  = myArray.map(function(value, index, elements) {
  var next = elements[index+1];
  // do something
});