Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript loop last index

for (const [i, value] of arr.entries()) {
    if (i === arr.length - 1) {
        // do your thing
    }
}
 
PREVIOUS NEXT
Tagged: #javascript #loop #index
ADD COMMENT
Topic
Name
1+2 =