<aside> ⚠️ This note serves as a reminder of the book's content, including additional research on the mentioned topics. It is not a substitute for the book. Most images are sourced from the book or referenced.

</aside>

All notes in this series

Infor & Preface

Chap 6 — Limiting Scope Exposure

Attention: decisions and patterns we apply across the whole program.

Least Exposure

→ Exposing min necessary, keeping everying else as private as possible.

Hiding in Plain (Function) Scope

❇️ Invoking Function Expressions Immediately

The last () in the previous code is call Immediately Invoked Function Expression (IIFE). It’s useful to create a scropt to hide var/func.

// standalone IIFE -> "()" surround function is required
(function(){ .. })();

// with a name -> "()" surround function isn't required
(function namedIIFE(){ .. })();
function nameIIFE(){...}()