📜  数组 javascript 代码示例中的最终迭代

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

代码示例1
var group = ["a","b","c","d"];
var groupLength = group.length;

for(var i = 0;i < groupLength;i++){
    var item = group[i];

    // Do something if is the last iteration of the array
    if((i + 1) == (groupLength)){
        console.log("Last iteration with item : " + item);
    }
}