I want to increment only when index passes the condition. Array length is dynamic. input_number is dynamic.
let increment = 0 let input_number = 4 array.forEach((arr, index) => { // increment++ when index > 4 && index <= 8 // increment++ when index > 8 && index <= 12 // increment++ when index > 12 && index <= 16 // so on... }) let increment = 0 let input_number = 3 array.forEach((arr, index) => { // increment++ when index > 3 && index <= 6 // increment++ when index > 6 && index <= 9 // increment++ when index > 9 && index <= 12 // so on... }) https://stackoverflow.com/questions/67293205/dynamically-increment-number-when-it-reaches-a-dynamic-input April 28, 2021 at 11:07AM
没有评论:
发表评论