7-when to 'while and when to 'for', not understanding why this isn't working



originally i had my own while loop and for loop for this exercise, however as it kept on not working i went back and attempted to copy and past a while loop that worked and a for loop that worked. still doesnt work. before doing so though i compared the syntax to the ones that worked and the ones i was doing- i did not see how my syntax was incorrect so i thought just copy and pasting them should work...well it doesn't. im not sure what exactly is wrong here. the error message reads:"unexpected token)" and was doing so before i copy& pasted my previous text. Any input would be appreciated.

var count= 0;

var loop = function(){
	while(count < 3){
	console.log("I'm looping!");
 for  ( var i=2;i < 23; i+++)  {



for ( var i=2;i < 23; i+++)

you added extra + it should be i++


thank you, jesus christ that was annoying. i was beginning to feel like i was getting high blood pressure. anyways, as stated- very much appreciated!


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.