👉 List of all notes for this book. IMPORTANT UPDATE November 18, 2024: I've stopped taking detailed notes from the book and now only highlight and annotate directly in the PDF files/book. With so many books to read, I don't have time to type everything. In the future, if I make notes while reading a book, they'll contain only the most notable points (for me).

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(){...}()