-
IIFETech/NodeJs 2020. 1. 10. 21:25반응형
Immediately Invoked Function Expression 즉시 실행되는 함수 표현 (function fn(){ const confidential = 'this is world' console.log('IIFE') })() //즉시 실행 함수로 표현 한 형태가 된다. 왜 이렇게 사용하는가? 외부에서 해당 함수위 변수나 객체에 대한 접근 통제 즉 fn 으로만 구현하여 사용한다면 confidential 을 접근 하게 된다. 호출을 하게 되면 블록안에 있기 때문에 오류가 발생한다. 따라서 접근 통제를 위해 사용함.
반응형'Tech > NodeJs' 카테고리의 다른 글
event emitter (0) 2020.01.10 setInterval (0) 2020.01.10 javascript hoisting (0) 2020.01.10 type checking (0) 2020.01.10 template string (0) 2020.01.10