2 hours ago · Tech · 0 comments

JavaScript cares not that it's a bank holiday! JavaScript demands your time! (Look, as always, the first bank holiday of the year is cold and kinda damp, so I could either be outside being miserable, or I could be wrapped up in a cozy blanket on the couch, going through JavaScript.) JavaScript LoopsLoops! Okay, let's see if I can get through loops without feeling utterly destroyed again, like I was with those Mammoth Club videos. The For Looplet text = ""; for (let i = 0; i < 5; i++) { text += "The number is " + i + "<br>"; } document.getElementById("demo").innerHTML = text; See, this is where I fell down with the last for demo. the i++. But here, W3Schools gives me the example and shows me how it works and I can copy/paste the text and see what's happening. I'm feeling better about for loops. It gets into Loop Scope, but I don't quite understand how one of the examples works. let i = 5; for (i = 0; i < 10; i++) { // some statements } document.getElementById("demo").innerHTML = i; The…

No comments yet. Log in to reply on the Fediverse. Comments will appear here.