Answer the question
In order to leave comments, you need to log in
How to make a loop within a loop synchronously?
Hello,
I need to make a loop, in a loop, so that it would work synchronously
, I have:
const arr = [1,2,3,4,5]
for(const item of arr){
console.log('check: ' + item)
if(something !== NULL){ //тут моя проверка
const arr2 = [a,b,c]
for(const item2 of arr2){
console.log('item: ' + item2);
}
}
}
check: 1
item: a
item: b
item: c
check: 2
item: a
item: b
item: c
check: 3
item: a
item: b
item: c
check: 4
item: a
item: b
item: c
check: 5
item: a
item: b
item: c
check: 1
check: 2
check: 3
check: 4
check: 5
item: a
item: b
item: c
item: a
item: b
item: c
item: a
item: b
item: c
item: a
item: b
item: c
item: a
item: b
item: c
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question