const images = ["0.jpg","1.jpg","2.jpg"]; //폴더 안에 있는 이미지 이름이랑 똑같게
const chosenImage = images[Math.floor(Math.random()*images.length)];
const bgImage = document.createElement("img"); //img요소 생성
bgImage.src = `img/${chosenImage}`;
document.body.appendChild(bgImage) //body에 html추가(가장 뒤에)'JavaScript' 카테고리의 다른 글
| #7.1 Adding ToDos (2) | 2023.02.15 |
|---|---|
| #7.0 Setup (1) | 2023.02.15 |
| #6.0 Quotes (1) | 2023.02.13 |
| #5.2 PadStart (0) | 2023.02.10 |
| #5.1 Timeouts and Dates (0) | 2023.02.10 |