Day-9 for loop, while loop

So Eun Ahn·2021년 1월 11일
0

JavaScript

목록 보기
13/26
post-thumbnail
post-custom-banner

loop

loop : can run the same code over and over again with out violates don't repeats yourself principles

for loop

for loop : use it when sure about how many iteration needed

while loop

while loop: loops through a block of code while a specified condition is true
use it when not sure how many iteration needed
while loop is more versatile than the for loop -> it can solve the problem without counter(without number that is increasing)

continue

continue: jumps over one iteration in the loop->exit the current iteration of the loop and continue to next one

break

break: completely terminate the whole loop when it reaches specified value


recap

x = y -> x = y
x += y -> x = x + y
x -= y -> x = x - y
x = y -> x = x y

code challenge에서 보너스 문제가 아직 이해가 덜 갔다 내일 회사 다녀와서 한번더 봐야 겠다...

profile
오늘도 새로운 도전을 한다
post-custom-banner

0개의 댓글