What is the difference between static and dynamic typing?
- Static typing: Variable types are known at compile-time (e.g., TypeScript, Java).
- Dynamic typing: Types are determined at runtime (JavaScript).
Example:
let x = 10; // number
x = "text"; // allowed