Notice
Recent Posts
Recent Comments
Link
초짜코딩의 잡동사니
반복문으로 테이블 출력하기 본문
1. 테이블 출력하기
1.1 for문을 이용해서 테이블을 출력하시오
{
let table = "<table>";
for(let i=1; i<=5; i++){
table += "<tr>";
for(let j=1; j<=5; j++){
table +="<td>1</td>"
}
table += "</tr>";
}
table += "</table>";
document.write(table);
}
1.2 for문을 이용해서 테이블을 출력하시오
1~25까지 출력하시오
{
let num = 1;
let table = "<table>";
for(let i=1; i<=5; i++){
table += "<tr>";
for(let j=1; j<=5; j++){
table +="<td>"+ num +"</td>"
num++
}
table += "</tr>";
}
table += "</table>";
document.write(table);
}
'JavaScript' 카테고리의 다른 글
반복문을 이용하여 출력하기 (0) | 2022.04.16 |
---|---|
데이터 제어하기 - 3 (0) | 2022.04.13 |
데이터 제어하기 - 2 (0) | 2022.04.13 |
데이터 제어하기 - 1 (0) | 2022.04.13 |
데이터 실행하기 - 4 (0) | 2022.04.13 |