Whiteship's Note

'자바스크립트 반복문'에 해당되는 글 1건

  1. 2007.07.09 JavaScript For Loop와 While Loop (1)

JavaScript For Loop와 While Loop

AJAX/JavaScript : 2007.07.09 12:54


참조 : http://www.w3schools.com/js/js_loop_for.asp

for 문 예제
<script type="text/javascript">
for (i = 1; i <= 6; i++)
{
document.write("<h" + i + ">This is header " + i)
document.write("</h" + i + ">")
}
</script>

while 문 예제
<script type="text/javascript">
i = 0
while (i <= 5)
{
document.write("The number is " + i)
document.write("<br>")
i++
}
</script>

do-while 문 예제
<script type="text/javascript">
var i=0
do
{
document.write("The number is " + i)
document.write("<br />")
i=i+1
}
while (i<0)
</script>

자바랑 동일하기 때문에 pass

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

JavaScript Special Characters  (0) 2007.07.09
JavaScript The onerror Event  (2) 2007.07.09
JavaScript Throw Statement  (0) 2007.07.09
JavaScript Try...Catch Statement  (0) 2007.07.09
JavaScript Events  (2) 2007.07.09
JavaScript For Loop와 While Loop  (1) 2007.07.09
JavaScript Functions  (0) 2007.07.09
JavaScript Popup Boxes  (0) 2007.07.09
JavaScript Operators  (0) 2007.07.09
JavaScript If...Else와 Switch Statement  (0) 2007.07.09
JavaScript Variables  (0) 2007.07.09
top