What is a FOR loop? In JavaScript, a for loop allows you to repeat instructions efficiently. Use this type of loop when you know how many times you’re going to be looping. They are useful for iterating arrays. Break out of the loop or continue to jump to increment instruction part of the loop.
Copyright (c) 2013 Rodrigo Silveira http://www.easylearntutorial.com
Original source
5 responses to “For Loop – JavaScript Tutorial for Beginners”
What about infinite loops where the condition the loop checks on is always true? How will this affect your javascript?
For now, you can try this (I'll show you a better way and explain it all later tonight):
function log(message) {
document.body.innerHTML += message;
}
No. console.log() prints to a file internal to the browser, not the HTML document you see and load through the browser.
Can you show a video where you do this using an external .js file please??
does console.log() work when I want to show something on the browser?