how to get last index from loop javascript code example
Example: javascript loop last index
for (const [i, value] of arr.entries()) {
if (i === arr.length - 1) {
// do your thing
}
}
for (const [i, value] of arr.entries()) {
if (i === arr.length - 1) {
// do your thing
}
}