0

Pls explain the for loops here?

for (var i = 0; i < arr.length; i++) { for (var j = 0; j < args.length; j++) { if (arr[i] === args[j]) { delete arr[i]; } } }. So, the first loop runs and the second loop keeps running until j is less than args.length?

17th Apr 2020, 3:45 PM
Sajid
Sajid - avatar
1 Resposta
0
1)first loop start. i become 0 2)second loop start. j become 0 3) second loop keep running till j > args.length..second loop done 4)i become 1,then repeat step 2..till i > arr.length
17th Apr 2020, 4:15 PM
durian
durian - avatar