1
I returned to study logic, because I was studying only front-end and hit me a very rough doubt, about one was of another.
for (var i = 1; i <=10 ; i++) {
for (var i2 = 1; i2 <=10; i2++){
document.write(i);
}
}
As you have seen he shows me the variable i 10 times, but I only asked (in logic) that he show me only first if it would be (1,2,3,4,5,6,7,8,9,10). Because he brought me the other’s values be repeated 10 times. Note: Make an explanation in depth, I could not understand by researches.
As you placed one for inside the other, the first for goes from 1 to 10 and the second for 1 to 10 and you are asking to print the value of the variable of the first for inside the second for, this will cause the i value to repeat 10 times in the first interaction and so repeat successively until finished. In case will print 10 times the 1, 10 times the 2 ..... up to 10 times the 10.
– novic