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

자바스크립트 완벽 가이드

by David Flanagan, Han Seon- yong
February 2022
Beginner to intermediate
784 pages
24h 53m
Korean
Insight
Content preview from 자바스크립트 완벽 가이드
JavaScript
136
5장 문
return
문은 함수 바디 안에만 쓸 수 있습니다. 다른 곳에 사용하면 문법 에러가 일
어납니다.
return
문이 실행되면
return
문을 포함한 함수는
expression
의 값을 호
출자에게 반환합니다. 예를 들어 다음을 보십시오.
function square(x) { return x*x; } // return
문이
있는
함수
square(2) //
=
> 4
return
문이 없는 함수 호출은 함수 바디의 각 문을 차례대로 실행한 다음 호출자
에게 돌아갑니다. 이런 경우 호출 표현식은
undefined
로 평가됩니다.
return
문은
보통 함수의 마지막에 사용하곤 하지만 꼭 마지막에만 써야 하는 것은 아닙니다.
함수는
return
문을 실행하는 즉시 호출자에게 돌아가며 함수 바디 안에 있는 다른
문은 무시합니다.
return
문을
expression
없이 사용해도 호출자에게
undefined
를 반환합니다. 예
를 들어 다음을 보십시오.
function displayObject(o) {
//
인자가
null
이나
undefined
이면
즉시
종료됩니다
.
if (!o) return;
//
함수의
나머지
부분
}
2.6절에서 설명한 자바스크립트의 자동 세미콜론 삽입 때문에
return
키워드와 그
뒤의 표현식 사이에는 줄바꿈을 ...
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

개발자를 위한 필수 수학

개발자를 위한 필수 수학

토머스 닐드
개발 7년차, 매니저 1일차

개발 7년차, 매니저 1일차

권원상, 한민주, 카미유 푸르니에

Publisher Resources

ISBN: 9788966263462