JS 반복문 (for 문)

2021. 7. 16. 01:53
728x90

 

- for 문은 초기식, 표현식, 증감식을 모두 포함하고 있는 반복문

  while (초기식; 표현식; 증감식){

     표현식의 결과가 참이 될 동안 반복적으로 실행하고자 하는 실행문;

     

 

 

 

 

<!DOCTYPE html>
<html>
<head>
  <meta charset='utf-8'>
  <meta http-equiv='X-UA-Compatible' content='IE=edge'>
  <title>for문</title>
  <meta name='viewport' content='width=device-width, initial-scale=1'>
  <script>
    for(i=0; i<5; i++){
      document.write("Hello World<br>");
    }
    document.write(i);
  </script>
</head>
<body>
</body>
</html>
 
cs
728x90

'JavaScript > Study' 카테고리의 다른 글

JS 반복문 중첩 (for 문)  (0) 2021.07.16
[JS] 반복문 중첩 (while 문)  (0) 2021.07.16
JS 반복문 (do / while 문)  (0) 2021.07.16
JS 반복문 (while 문)  (0) 2021.07.16
JS 삼항 연산자 (표현식 ? 반환식1 : 반환값2)  (0) 2021.07.15

BELATED ARTICLES

more