3/33 ReferenceError: "Invalid left hand side expression in postfix"

for (var i=1; i<=20; 1++){
    if ((i%3===0)&&(i%5===0)){
    else (i%3===0){
    else if (i%5===0){
    else {

the error i'm getting is ReferenceError: "Invalid left hand side expression in postfix"

what does that mean?


One thing I'm noticing is that
else (i%3===0){
should be
else if (i%3===0){
other than that I have no clue.


apart from the case @corepro16878 put forward (else should be else if),


for ([initialization]; [condition]; [final-expression/postfix]) {

you are using 1++ instead of i++
as 1++ stands for 1 = 1 + 1 you will get "Invalid left hand side expression in postfix"


This may help us:

for(var i=?;i<=?;i++){
   } else if(){
   } else if(){
   } else{

i++ instead of 1++.


Please read code convention IF ELSE-IF


If you (like I), have a fear of links for any reason (viruses), whether that fear is warranted or not (it's not), @leonhard_wettengmx_n is saying there shouldn't be a semi-colon on any if - else if - else statement. Hope it helps!


First of all, I think your loop is not correct:

for (var i=1; i<=20; 1++)  {  }

I think you should write like this:

for (var i=1; i<=20; i++) { }



im stuck on it too i dont get it


you should put I++ and an else if


thank you , but which semi-colon:

      };      ?
};            ?


The first closing bracket shouldn't have a semi-colon, as that's part of the if statement. I wouldn't suggest having either of those semi-colons though, because in reality you'd only use the semi-colon after a closing bracket when:

  • Ending and Object

var Example = { };
  • Ending an initialized variable function

var Example = function(){ ... };

Other than that I believe you shouldn't use the semi-colons after the closing brackets. Somebody please correct me if I'm wrong.


Yeah. i guess you are right lolman , thanks a lot @lolman