webmanz Posted April 24, 2018 Report Share Posted April 24, 2018 (edited) 3.52 minute mark of chapter 7 part 3 Loops Q1: Why does the + target.innerHTML added at the end (see code below) appear in ascending order on the web page rather than descending like it does in the console.log? I do realize that you can achieve descending result by adding + target.innerHTML in the front to match console.log but I'm curious why when added to the end it gives a ascending order rather than descending order? Here's the code from that lesson 3.52 minute mark of chapter 7 video part 3 Loops: function doItAgain(message){ var loopCount=5; while (loopCount > 0) { var target = document.getElementById("target"); target.innerHTML="LoopCount:" + loopCount + "<br> + target.innerHTML; <------------ referring to this line console.log("loopCount is now:" + loopCount); loopCount=loopCount -1; } console.log ("End loop"); var button= document.getElementById("looper"); button.value="Done looping!"; } Edited April 24, 2018 by webmanz Quote Link to comment Share on other sites More sharing options...
administrator Posted May 7, 2018 Report Share Posted May 7, 2018 Sorry for the delay. Has to do how console.log works in the browser. Not important to know those details ... just get your code working in the web browser. Stef Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.