Skip to Content
자바스크립트 + 리액트 디자인 패턴
book

자바스크립트 + 리액트 디자인 패턴

by 애디 오스마니(Addy Osmani), 윤창식
August 2024
Beginner to intermediate
384 pages
7h 38m
Korean
Hanbit Media, Inc.
Content preview from 자바스크립트 + 리액트 디자인 패턴
261
Chapter 11_
네임스페이스 패턴
11.6
즉시 실행 함수 표현식 패턴
이전에 즉시 실행 함수 표현식
Immediately
Invoked
Function
Expressions
(
IIFE
)의 개념에 대해 간략하게
다룬 적이 있습니다. 즉시 실행 함수는 정의 직후 바로 실행되는, 이름이 없는 함수입니다.
아마 익숙하신 분도 계실텐데, 자기 실행 (혹은 자기 호출 ) 익명 함수라고 들어보셨을 겁니
다. 저는 개인적으로 벤 알만
Ben
Alman
이 즉시 실행 함수라고 칭한 것이 더 정확하다고 생각합
니다. 자바스크립트에서는 즉시 실행 함수로 정의된 내부의 변수와 함수 모두 외부에서 접근
할 수 없습니다. 따라서, 함수를 호출하는 것만으로도 쉽게 코드의 은닉성을 구현할 수 있습
니다.
즉시 실행 함수는 애플리케이션의 로직을 캡슐화하여 전역 네임스페이스로부터 보호하는 데
널리 사용되는 방법입니다. 하지만 이러한 특징은 네임스페이스의 영역에서도 유용하게 활
용될 수 있습니다. 다음은 즉시 실행 함수의 예시입니다.
// 즉석에서 호출되는 (익명의) 함수 표현식
(() => { /*...*/})();
// 이름이 있는 즉시 실행 함수 표현식
(function foobar () { /*..*/}());
// 문법적으로는 자기 실행 함수지만 앞의 예시들과는 꽤 다릅니다. ...
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

실전 시계열 분석: 통계와 머신러닝을 활용한 예측 기법

실전 시계열 분석: 통계와 머신러닝을 활용한 예측 기법

박찬성, 에일린 닐슨
클라우드 엔지니어를 위한 97가지 조언

클라우드 엔지니어를 위한 97가지 조언

Emily Freeman, Nathen Harvey, 정기훈(Jung Ki Hun)

Publisher Resources

ISBN: 9791169212571