Back to feed
Renewal·서른의 생활코딩

Sample source 2) Basic JavaScript document structure ( continue and break statements )

NS
normalstory
cover image


continue and break


Various ways to handle exceptions...
Honestly..I dozed off a bit during this part, so this is the only example I have..
If anyone has good source code, please let me know...


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ko" lang="ko">




<head>


<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" />


<title> continue _1 </title>


</head>




<body>




<script type="text/javascript">


//<!CDATA[




/* Sum up all the numbers from 1 to 50 except the multiples of 3.




break exits completely,


continue skips only the items that satisfy the condition,


and keeps running the rest. */


*/




var sum=0;




for(i=1;i<51;i++){


if(i&3==0) continue;


sum+=i;


}


document.write(sum);




//]]]]>


</script>




</body>


</html> 

This English version was translated by Claude.

친절한 찰쓰씨
Written by
친절한 찰쓰씨

Pleasant Charles — UI/UX researcher at AIT. Keeping notes on design, planning, and slow days here since 2010.

More on the author's page

Keep reading

Renewal

Steadily, for the long haul, without burning out

Mar 31, 2026·9 min
Renewal

Tech-life balance

Feb 7, 2026·3 min
Renewal

Humanality, by Park Jeong-ryeol

Feb 7, 2026·11 min