var rand;
var count = 0;
function gimmeRandom();
{
rand = Math.floor(Math.random()*10)+1;
count++;
return(gimmeRandom);
}
function countToRandom();
{
var count;
for(count = 1; count <= rand; count++)
{
console.log(count);
}
}
console.log("counting to a random number");
gimmeRandom();
countToRandom();
console.log("counting to another random number");
gimmeRandom();
countToRandom();
console.log(there has been "+count+" random numbers");
그래서 내가 필요로하는 도움말은이 코드를 사용하지만 countToRandom을 사용하여 매개 변수를 받아들이고 매개 변수에 제공된 값으로 계산하는 것입니다. countToRandom() 매개 변수를 받아 들일 때
는 코드가 작동
임 – itsMad
단순히 인수로 숫자를 전달하고 기능의 한계로 그 값을 사용하는 함수 이름 뒤에이 세미콜론입니다 죄송합니다 당신이'카운트 '처럼. –