i have syntax error when i’m trying to run a simple if statements
[Break On This Error] });
invalid assignment left-hand side
[Break On This Error] container +=
what is my problem
and how i can make:
if this.ewCount != 0 then {}
elseif NotDoneh == 0 then {}
ELSE {}
this is my current code:
var conta = '<div>';
$.each(items, function () {
if (this.ewCount != 0) {
if (DoneWidth == 0) {
conta += '<br/>dddddddddddddddddd<br/><br/>' +
});
if (NotDoneh == 0) {
conta += '<br/>dddddddddddddddddd<br/><br/>' +
});
});
container += '</div>' +
To take your pseudo-code:
and turn it into JavaScript:
In your actual JS there are several problems, mainly that you’ve got the + operator on the end of some lines without another operator after it, and you’ve closed each of your if statements with
});when they should’ve just had}– I think you’ve got that mixed up with how you need to close the$.eachsince it is a function call with a function as a parameter so it needs to be$.each(items,function() { });.I’m not sure how to rewrite your JS, because it has an
if (DoneWidth == 0)test that isn’t in your pseudo-code – is that supposed to be nested inside the first if, or…? Anyway, if you update it to look like the following it should at least be valid, even if not the right algorithm:You can put that together with the if/else structure that I showed above, and/or otherwise move things around so the right bit of code ends up inside the right if or else.