📜  js 检测数组的结尾 - Javascript 代码示例

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

代码示例2
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);
    }
}