Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR TYPESCRIPT

How to find last iteration in for loop in typscript

const data = [1, 2, 3];
let iterations = data.length;

for (item of data)
{
    if (!--iterations)
        console.log(item + " => This is the last iteration...");
    else
        console.log(item);
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #How #find #iteration #loop #typscript
ADD COMMENT
Topic
Name
1+9 =