推 Peruheru: var compare = function(choice1,choice2) 這行可以當作 11/18 10:04
→ Peruheru: 將後面那個function取名叫compare,而要使用時則是寫成 11/18 10:04
→ Peruheru: 類似var result=compare(userChoice, computerChoice); 11/18 10:06
→ Peruheru: 第三行宣告的只是函式的"行為",這時候還用不到前面變數 11/18 10:07
推 Peruheru: 而要執行那個行為,則要再多寫一行執行的程式,如前述 11/18 10:09
→ Peruheru: 我不知道你compare最後會回傳什麼,或是沒有要回傳 11/18 10:09
→ Peruheru: 不過那樣寫應該是不會爆的 11/18 10:10
→ Peruheru: 好啦就算我真的寫錯了,總之你缺的就是一行執行而已(虛) 11/18 10:11
→ wendyhard: 謝謝你的觀念與解答! 11/18 10:45