티스토리 뷰

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.17 | 
|---|---|
| 자바스크립트 - 문자열 객체 (0) | 2022.04.17 | 
| 자바스크립트 출력 (0) | 2022.04.15 | 
| 자바스크립트 - 이벤트 객체 mouseout VS mouseleave (0) | 2022.04.15 | 
| 자바스크립트 - 이벤트 객체 mouseover VS mouseenter (0) | 2022.04.15 | 
					댓글
						
					
					
					
				
			
						© 2018 webstoryboy
					
				 
										
									 
										
									 
										
									