<PLEASE USE THE FOLLOWING TEMPLATE TO HELP YOU CREATE A GREAT POST!>
<Below this line, add a link to the EXACT exercise that you are stuck at.>
This topic is a simple, but general coding discrepancy within my brain. Well, as you can see, the code below is what happened when there was an open coding space. I just went nuts. Please mind the grammar and spelling mistakes in the code. This topic is going to center mostly around the for and while loop. My situation is when I run this code, the console logs all of the statements in ‘for’ but not for ‘while’. The behavior I wanted the code to have was log the statement “filler” in the console as the number counted up, as many times the input started. This part worked, but the while loop was ignored. I wanted the while loop to log “what” when the input, in the for loop, reached 8. I did not log the statement. why is this?
I do understand that for loops repeat the actions in the brackets, as long as the condition stays true. While loops are the same, as they do whatever is in the brackets, stopping at the condition, but they’re a bit broad. While loops allow for not only number conditions but Boolean conditions, so you can set all sorts of things. Also, while loops run because a programmer might not know how often the code will run. Now that you know that I understand what these two loops are, why do the statements in the while loop not log as long as the for loops is running and logging statements into the console?
<In what way does your code behave incorrectly? Include ALL error messages.>```
var input = prompt(“Waht meat do ya like?!”);
var input2 = prompt(“Pick a number from 1 through 5”);
for(var input2 = input2; input2 < 10; input2++)
while(input2 < 8)
console.log(“Glory to Mother Bacon”);
console.log(“no, just no”);
console.log(“didn’t get that”);
<do not remove the three backticks above>