How to refer to a single element in a “for” loop in js?
For example:
let count = 0;
do {
document.writeln('hello
');
count++;
} while (count < 7);
how to address for example to the 3 element?
How to refer to a single element in a “for” loop in js?
For example:
let count = 0;
do {
document.writeln('hello
');
count++;
} while (count < 7);
how to address for example to the 3 element?
Hi @GribokT_T - welcome to the forums
What you have is a do/while loop which is different than a for loop In a for loop, you can access the item by referring to what is known as the index position. Take a look at this article that will explain this further: For, While, and Do...While Loops
Let me know if that helps answer your question. If not, please do reply back and we can look at this further.
Cheers,
Kirupa
:: Copyright KIRUPA 2024 //--