Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

js backward iteration array

for(let i = 0; i < arr.length; i++){
    console.log(arr.slice(arr.length-10-i, arr.length-i))
} 
/*
arr is [0, 1, 2, 3, ..., 199, 200]
VM1088:2 (10) [191, 192, 193, 194, 195, 196, 197, 198, 199, 200]
VM1088:2 (10) [190, 191, 192, 193, 194, 195, 196, 197, 198, 199]
VM1088:2 (10) [189, 190, 191, 192, 193, 194, 195, 196, 197, 198]
VM1088:2 (10) [188, 189, 190, 191, 192, 193, 194, 195, 196, 197]
VM1088:2 (10) [187, 188, 189, 190, 191, 192, 193, 194, 195, 196]
VM1088:2 (10) [186, 187, 188, 189, 190, 191, 192, 193, 194, 195]
VM1088:2 (10) [185, 186, 187, 188, 189, 190, 191, 192, 193, 194]
VM1088:2 (10) [184, 185, 186, 187, 188, 189, 190, 191, 192, 193]
VM1088:2 (10) [183, 184, 185, 186, 187, 188, 189, 190, 191, 192]
VM1088:2 (10) [182, 183, 184, 185, 186, 187, 188, 189, 190, 191]
*/
Source by www.techiedelight.com #
 
PREVIOUS NEXT
Tagged: #js #iteration #array
ADD COMMENT
Topic
Name
7+2 =