📌
Javascript+jQuery
  • 자바스크립트 시작하기
  • 자바스크립트 기초 문법
  • 변수
  • 배열
  • 객체
  • 연산자
  • 조건문
    • if문
    • if~else문
    • 다중 if문
    • 중첩 if문
    • switch문
    • 삼항 연산자
  • 반복문
    • while문
    • do while문
    • for문
    • 중첩 for문
    • break문
    • continue문
  • 함수
    • 선언적 함수
    • 익명 함수
    • 매개변수가 있는 함수
    • arguments 함수
    • return값이 있는 함수
    • 재귀 함수
    • 콜백 함수
    • 내부함수(스코프)
    • 객체 생성자 함수
    • 프로토타입 함수
    • 화살표 함수
    • 함수정리
    • 템플릿 리터럴
    • 클래스
  • 내장객체
    • String 객체
      • split()
      • join()
    • Number 객체
    • Date 객체
    • Array 객체
    • Math 객체
    • 정규표현 객체
  • 브라우저 객체
    • window 객체
    • navigator 객체
    • screen 객체
    • history 객체
    • location 객체
  • 문자 객체
  • 이벤트
Powered by GitBook
On this page

Was this helpful?

  1. 반복문

중첩 for문

for문 안에 for문을 사용한 것을 중첩 for문이라고 합니다.

중첩 for문

for(var i = 0; i<100, i++){ for(var j =0; j<100; j++){ //반복코드 } }

for(let i =1; i<=10, i++){
    //document.write(i);
    for(let j=1; j<=10; j++){
        document.write(i+","+j,"<br>");
    }
}

구구단

/* i*j=sum
    i(2~9까지 출력) for(i=2; i<=9; i++)
    j(1~9까지 출력) for(j=1; j<=9; j++)
    2*1=2       3*1=3
    2*2=4       3*2=6
    2*3=6       3*3=9
    2*4=8       3*4=12
    2*5=10      3*5=15
    2*6=12      3*6=18
    2*7=14      3*7=21
    2*8=16      3*8=24
    2*9=18      3*9=27*/
    
for(let i = 2; i<=9; i++){
    for(let j = 1; i<=9; j++){
        let sum = i*j;
        document.write(i +"*"+j+"="+sum);
        document.write("<br>")
    }
}
Previousfor문Nextbreak문

Last updated 4 years ago

Was this helpful?