Skip to Content
자바스크립트 완벽 가이드
book

자바스크립트 완벽 가이드

by David Flanagan, Han Seon- yong
February 2022
Beginner to intermediate
784 pages
24h 53m
Korean
Insight
Content preview from 자바스크립트 완벽 가이드
the De󼴩nitive Guide
121
5.3 조건문
이 코드에서는 각
case
의 마지막에
break
키워드를 썼습니다.
break
문은 이 장에
서 다시 설명하겠지만, 인터프리터가
switch
문의 끝으로 빠져나가서 이어지는 문
을 실행하게 하는 명령입니다.
switch
문의
case
절은 코드의
출발점
출발점을 지정할 뿐,
어디서 끝나는지는 지정하지 않습니다.
break
문이 없다면
switch
문은
expression
의 값과 일치하는
case
라벨을 찾아 코드를 실행한 다음, 블록의 끝에 다다를 때까
지 실행을 계속합니다. 아주 가끔은 이렇게
case
라벨에서 계속 실행하는 것이 유
용할 때가 있지만,
case
절마다
break
문으로 끝내야 하는 경우가 99%입니다. 하지
만 함수 안에서
switch
를 쓸 때는
break
문 대신
return
문을 써도 됩니다. 어느 쪽
이든
switch
문을 종료하므로 다음
case
로 넘어가지 않습니다.
다음은
switch
문의 좀 더 현실적인 예제입니다. 이 문은 값을 그 타입에 따라 문
자열로 변환합니다.
function convert(x) {
switch(typeof x) {
case "number": //
숫자를
16
진수로
변환합니다
.
return x.toString(16);
case "string": //
문자열을 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

코드로 인프라 관리하기(2판)

코드로 인프라 관리하기(2판)

키프 모리스

Publisher Resources

ISBN: 9788966263462