While 예제
<p id="hz"></p> <script> var text = ""; var i = 0; while (i < 5) { text += "<br>숫자: " + i; i++; } document.getElementById("hz").innerHTML = text; </script> 결과보기
<p id="hz"></p>
<script>
var text = "";
var i = 0;
while (i < 5) {
text += "<br>숫자: " + i;
i++;
}
document.getElementById("hz").innerHTML = text;
</script>
결과보기