I have to say this learning program is stupid


#1

I am getting sick and tired of literally writing EXACTLY what is shown in the example and then being told that the syntax is wrong--with no other explanation. I mean it would be nice if the program at least could highlight or point to where in the code the supposed mistake is, but I feel like it's just a guessing game where I keep changing crap until it tells me it's right.

Here is what I have and once again it is EXACTLY like the example shows....yet it tells me it's not right.

if(choice1 === choice2) {
return "The result is a tie!";
}
else if(choice1 === "rock") {
if(choice2 === "scissors") {
return "rock wins";
}

}

So what is the program actually wanting????


#2

Try this

  var compare = function(choice1, choice2){
    	if(choice1 === choice2){
    		return ("The result is a tie!");
    	}
    	if (choice1 === "rock"){
    		if(choice2 ==="scissors"){
    			return "rock wins";
    		}
    		else{
    			return "paper wins";
    		}
    	}
    };

#3

I do have the var compare... part in my code I just skipped it because that part was completed in a previous lesson.

I also added the ";" symbol after my last bracket and it is still saying there is a syntax error.

However I did find the error...there was a symbol carried over from the previous lesson that apparently needed to be deleted but they didn't mention that part in the instructions. :angry:


#4

NOW WHAT THE HECK IS WRONG WITH IT!!????

var compare = function(choice1, choice2) {
        if (choice1 === choice2) {
            return ("The result is a tie!");
        } else if (choice1 === "rock") {

            if (choice2 === "scissors") {
                return "rock wins";
            } else {
                return "paper wins";
            }

        } else if (choice1 === "paper") {
            if (choice2 === "rock") {
                return "paper wins";
            } else {
                return "scissors wins";
            }
        }

#5

and whats that symbol?


#6

@jstevens526,

Read
http://www.codecademy.com/forum_questions/559dcb4be39efe550f00006b
and concentrate on

  • the build of the IF ELSE-IF statement structure
  • dont forget the closing-curly-bracket-} with which you close the FUNCTION-BODY

#7

Really??? You guys archived this...what that means is....rather than take the user's frustration and actually come up with new ways to help learners figure out what they are doing wrong...you have chosen to just ignore the problem altogether and just give me a link that provides information that is just as wordy as what is given during the lesson.


#8

Seems like you're missing the closing } for the function also the use of indentations and other formatting stuff really helps to find anything in your code, for other but most important for you as well. Also if you're to lazy to do it you can also find site like http://jsbeautifier.org/ to do this for you. For the archive, this is the new forum so the old forum is disabled and all posts there are archieved. If you could post there as well you would have 2 forums and no one would no where to look for an answer.