This forum is now read-only. Please use our new forums! Go to forums

0 points
Submitted by Tonny Keinicke
over 8 years

"R, P, S" 5/9

Code is as follows: var userChoice = prompt(“Do you choose rock, paper or scissors?”); var computerChoice = Math.random(); if (computerChoice < 1/3) { computerChoice = “rock”; } else if(computerChoice <= 2/3) { computerChoice = “paper”; } else { computerChoice = “scissors”; }
console.log(“User: “ + userChoice); console.log(“Computer: “ + computerChoice);

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

As such this is being accepted, but when i run through it, it seems that every possible result is giving the “The result is a tie!” output. Basically I can’t figure out what is being compared with “var compare = function(choice1, choice2)”

Any help would be appreciated!

BR /Tonny

Answer 55ddfedad3292f25a70001db

0 votes

Permalink

Have read through http://www.codecademy.com/forum_questions/559dcb4be39efe550f00006b

Reference

google search == the Book == javascript [your question] site:developer.mozilla.org

== discussions / opinions == javascript [your question] site:stackoverflow.com

== guidance == www.crockford.com http://javascript.crockford.com/code.html http://javascript.crockford.com/survey.html https://developer.mozilla.org/en-US/docs/Web/JavaScript/A_re-introduction_to_JavaScript www.developer.mozilla.org/en-US/docs/Web/JavaScript/Guide

points
Submitted by Leon
over 8 years