Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6956181
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T14:50:05+00:00 2026-05-27T14:50:05+00:00

i have syntax error when i’m trying to run a simple if statements [Break

  • 0

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>' +
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T14:50:06+00:00Added an answer on May 27, 2026 at 2:50 pm

    To take your pseudo-code:

    if this.ewCount != 0 then {}  
    elseif NotDoneh == 0 then {} 
    ELSE {}
    

    and turn it into JavaScript:

    if (this.ewCount != 0) {
       // do something
    } else if (NotDoneh == 0) {
       // do something else
    } else {
       // do something else again
    }
    

    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 $.each since 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:

    $.each(items, function () {
        if (this.ewCount != 0) {
            // note the following if is nested inside the one above: not sure
            // if that's what you intended, but it gives a good example of
            // how to do something like that
            if (DoneWidth == 0) {
                conta += '<br/>dddddddddddddddddd<br/><br/>';
            }
        } else if (NotDoneh == 0) {
                conta += '<br/>dddddddddddddddddd<br/><br/>';
        } else {
            // you don't seem to have any code to go in the final else,
            // unless it was meant to be
            container += '</div>';
        }
    
        container += '</div>';
     }); // note here }); is correct because the } closes the anonymous function
         // and then the ); finishes off the $.each(...
    

    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.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I get this error:- You have an error in your SQL syntax; check the
I have seen this syntax in MSDN: yield break , but I don't know
Firebug is complaining about this line: $(#original-description).text(response['course']['original_description']).hide(); Do I have a syntax error? Looks
I have a syntax error in this subquery that I cannot seem to figure
i have this error Parse error: syntax error, unexpected '{' in receive/register.php on line
This is really, really weird. Basically, I have a MySQL syntax error occurring because
Perhaps it's a syntax error, but I never assume that. I have a -dead-
You have an error in your SQL syntax; check the manual that corresponds to
Notice: You have an error in your SQL syntax; check the manual that corresponds
I have this syntax which works (since it's from the API, pretty much) <%

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.