嘿,我在codeacademy,我想弄清楚我的函数的结构有什么问题。我认为这很好,但它不起作用。谁能告诉我为什么?岩石纸剪刀的Javascript语法问题逻辑
var compare = function (choice1,choice2){
if("choice1 = choice2"){
return ("The result is a tie!");
}
};
compare(1,1);
if ("choice1 = rock"){
if ("choice2 = scissors"){
return ("rock wins");
} else {
return ("paper wins");
}
}
请检查的一些应用手册,谷歌的互联网。我会从这里开始http://jqfundamentals.com/chapter/javascript-basics – elclanrs
你混淆了字符串变量 –
我猜你是初学者?检查操作员。 ==或===等于。继续编码! –