01. 수학 메서드 : Math.random() : 0과 1 사이에 난수 값을 반환 : 반환 (숫자)

번호 기본값 메서드 리턴값 클릭
document.querySelector(".sample01_N1").innerHTML = 1;
document.querySelector(".sample01_Q1").innerHTML = "0 ~ 1";
document.querySelector(".sample01_M1").innerHTML = "Math.random()";
document.querySelector(".sample01_P1").style.color = "black";
document.querySelector(".sample01_B1").addEventListener("click", () => {
    document.querySelector(".sample01_P1").innerHTML = Math.random();
})

document.querySelector(".sample01_N2").innerHTML = 2;
document.querySelector(".sample01_Q2").innerHTML = "0 ~ 9";
document.querySelector(".sample01_M2").innerHTML = "Math.random()";
document.querySelector(".sample01_P2").style.color = "black";
document.querySelector(".sample01_B2").addEventListener("click", () => {
    document.querySelector(".sample01_P2").innerHTML = Math.floor(Math.random() * 10);
})

document.querySelector(".sample01_N3").innerHTML = 3;
document.querySelector(".sample01_Q3").innerHTML = "10 ~ 19";
document.querySelector(".sample01_M3").innerHTML = "Math.random()";
document.querySelector(".sample01_P3").style.color = "black";
document.querySelector(".sample01_B3").addEventListener("click", () => {
    document.querySelector(".sample01_P3").innerHTML = 10 + Math.floor(Math.random() * 10);
})