Type Systems
Understanding static vs dynamic typing and advanced type features.
Key Concepts
+ Add ConceptJavaScript Closures
Closures
A closure is the combination of a function bundled together (enclosed) with references to its surrounding state (the lexical environment). In JavaScript, closures are created every time a function is created, at function creation time.
Structural vs Nominal Typing
Structural Typing
TypeScript is a structurally typed language. This means that two types are compatible if they have the same “shape”, regardless of their names. In contrast, nominal typing (like in Java or C#) requires explicit inheritance or implementation for compatibility.