1var group = ["a","b","c","d"];
2var groupLength = group.length;
3
4while (groupLength--) {
5 var item = group[groupLength];
6
7 if(groupLength == 0){
8 console.log("Last iteration with item : " + item);
9 }
10}
1var group = ["a","b","c","d"];
2var groupLength = group.length;
3
4for(var i = 0;i < groupLength;i++){
5 var item = group[i];
6
7 // Do something if is the last iteration of the array
8 if((i + 1) == (groupLength)){
9 console.log("Last iteration with item : " + item);
10 }
11}