Read the short tutorials in the following:


Read JS Loop For In, JS Loop For Of, While, JS Break

https://www.w3schools.com/js/js_loop_for.asp