카테고리 없음

[자바스크립트] 코드아카데미 문제풀이 Build "Rock, Paper, Scissors" (3/9)

tomato23 2014. 7. 23. 13:18

 

[자바스크립트] 코드아카데미 문제풀이 Build "Rock, Paper, Scissors" (3/9)

 

Computer Choice: Part 1

Awesome! We now need the computer to make a choice. The game is only going to be fun if the computer chooses randomly. Luckily JavaScript has something that can help with this.

If we declare a variable and make it equal to Math.random(), that variable will equal a number between 0 and 1.

원문링크

 

var 변수 computerChoice에 랜덤 값을 대입시킵니다.

var userChoice = prompt("Do you choose rock, paper or scissors?");
var computerChoice = Math.random();
console.log(computerChoice);

 

위와 같이 입력하면 통과합니다.

 

 

 

전체 목록 바로가기

 

반응형