www.webdeveloper.com
Results 1 to 2 of 2

Thread: Need Help; Keep getting SyntaxError: missing } in compound statement

  1. #1
    Join Date
    May 2013
    Posts
    1

    Unhappy Need Help; Keep getting SyntaxError: missing } in compound statement

    here is my .js code:


    alert("JavaScript works!");

    // 5-8-13
    // Brian Stacks
    // SDI 1305
    // Project 1
    // My first dealings in JavaScript

    // My variables
    var appName = "Disearchable Ability.";
    var goodAppColors = "Blue";
    var badAppColors = "Red";
    var numOfGoodAppColors = 1;
    var appLayout1 = "\"List\" and \"Grid\" Style";
    var appIsGood = true;

    // My first outputs
    console.log("My app's name is " + appName);
    console.log("It is " + appIsGood + " that my apps main color is blue. ");
    console.log("My app has " + numOfGoodAppColors + " color.");
    console.log("My app has " + appLayout1 + " as it's layout options.")

    if (appIsGood === true){
    // this is the code block that runs if appIsGood is true.
    if(numOfGoodAppColors <= 1){
    //this runs if appIsGood is true and if numOfGoodAppColors <=1
    appIsGood = (numOfGoodAppColors + 0);{
    console.log("If the app has " + numOfGoodAppColors + " color then I need to finish it. ")}

    }else {
    if (numOfGoodAppColors >= 2){
    // this is the code block that runs when numOfGoodAppColors is false}
    console.log("If the app has " + numOfGoodAppColors > 1 + " color I need a new idea ");{
    //this runs if appIsGood is true and if numOfGoodAppColors <=1
    }
    if (goodAppColors === "Blue"){
    //this is the code block that runs if goodAppColors is true.
    if (goodAppColors = "Blue"){
    console.log("If the app is " + goodAppColors + " , it's a good app!")
    }else{
    if (badAppColors === true);{
    //this is the code block that runs when goodAppColors is false
    console.log("If the app is " + (badAppColors) + " , it's a bad app!")}

    }


    }if (appLayout1 === true){
    //this is the code block that runs if appLayout1 is true
    if (appLayout1 = "\"List\" and \"Grid\" Style"){
    console.log("If the app has " + appLayout1 + " it's a good app ")}
    }else{
    if (appLayout1 != "\"List\" and \"Grid\" Style"){
    console.log("If the app doesn't have " + appLayout1 +", back to the drawing board. ");}
    }

  2. #2
    Join Date
    May 2006
    Location
    Somewhere behind your screen
    Posts
    1,633
    it seems you are missing more than one } and check to see that there is no single = inside if()

    to avoid getting chaos in the code use a text processor with synthax hilighting and try to turn those your 'stairs' like

    Code:
    }else{
     if (appLayout1 != "\"List\" and \"Grid\" Style"){
     console.log("If the app doesn't have " + appLayout1 +", back to the drawing board. ");}
     }
    into lines like

    Code:
    }
    else{if(appLayout1 != "\"List\" and \"Grid\" Style"){console.log("If the app doesn't have " + appLayout1 +", back to the drawing board. ");}}
    xxx: Guess Buddhist riddle: "What is the sound of one hand clapping?"
    yyy: facepalm

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles