# 4. Computer Choice: Part 2 - Help im stuck

var userChoice = prompt(“Do you choose rock, paper, scissors?”);

var computerChoice = Math.random();
console.log(computerChoice);
if (computerChoice <= 0.33){
}else if(computerChoice <= 0.66){
}else(computerChoice <=1){
};
console.log(“Computer” + computerChoice);

Oops, try again. There was a problem with your syntax.

The above is the syntax error. `else` is a default branch that takes no conditional.

``````if (condition1) {
// branch if true
}
else if (condition2) {
// branch if true
}
else {
// default branch
}
``````

Also, `alert()` is a one-off statement that does not store any value. We need to store the value, not output it.

``````computerChoice = "rock";
computerChoice = "paper";
computerChoice = "scissors";``````
4 Likes

Thank you very much, that’s gonna help me on the future

1 Like

it appears “oops try again! there was a problem with your syntax.”

var userChoice = prompt(“Do you choose rock,paper or scissors?”);
var computerChoice = Math.random()
console.log(computerChoice)
if (computerChoice<=0.33) {
computerChoice=“rock”;
}
else if (computerChoice<=0.66) {
computerChoice=“paper”;
}
else (computerChoice<=1) {
computerChoice=“scissors”;
}

If you read the 2nd post in this topic, I believe you will solve the problem you’re having.

Make sense! Thank you!

I am not sure what I did wrong…
var userChoice = prompt(“Do you choose rock, paper or sissors?”);
var computerChoice = Math.random();
console.log(computerChoice);
if (computerChoice <= 0.33){
computerChoice = “rock”;
};
else if (computerChoice <=0.66){
computerChoice = “paper”;
};
else{
computerChoice = “sissors”;
};

it shows:
there was a problem with your syntax

Move this console.log statement over to the last line

And here,

You wrote sissors instead of “scissors”: .

Thanks! I never knew i typed sissors instead of scissors! XD

1 Like

After I change you noticed above, it still shows syntax error…

What do you mean? it’s still not passing?

yes. Still not passing

you have 3 semicolons which are not needed

There shouldn’t be semi colons next to your closing brackets on all if statements,

``````
if (computerChoice <= 0.33){
computerChoice = "rock";
};<--
else if (computerChoice <=0.66){
computerChoice = "paper";
}; <--
else{
computerChoice = "sissors";
};<--
``````

Is problem fixed? coolprogrammer2003

Ic thanks. That helps me a lot.

Yes. Problem fixed. Thanks
{"ft_lang_label":"__label__en","ft_lang_prob":0.6976286,"math_prob":0.6859868,"size":767,"snap":"2022-27-2022-33","text_gpt3_token_len":205,"char_repetition_ratio":0.28440368,"word_repetition_ratio":0.041237112,"special_character_ratio":0.2816167,"punctuation_ratio":0.21804512,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.97429436,"pos_list":[0,1,2],"im_url_duplicate_count":[null,null,null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2022-07-04T13:03:19Z\",\"WARC-Record-ID\":\"<urn:uuid:a2828519-474a-428f-8699-be62187901d0>\",\"Content-Length\":\"64377\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:af59fc2f-f7df-4db3-bc99-11526379a0a8>\",\"WARC-Concurrent-To\":\"<urn:uuid:88f4798a-4380-44be-808d-7bfc86c40d8c>\",\"WARC-IP-Address\":\"64.71.144.203\",\"WARC-Target-URI\":\"https://discuss.codecademy.com/t/4-computer-choice-part-2-help-im-stuck/43907\",\"WARC-Payload-Digest\":\"sha1:OAM6HIH4R36YQ4MNX62MCU72MZUYUU6X\",\"WARC-Block-Digest\":\"sha1:6QEFWQUCX57UMDZ2UQF3LKETYGXNLRE4\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2022/CC-MAIN-2022-27/CC-MAIN-2022-27_segments_1656104375714.75_warc_CC-MAIN-20220704111005-20220704141005-00560.warc.gz\"}"}