Typescript: why can't i reassign a variable declared with 'const'?
Example:
const x = 10;
x = 20; // Error: Cannot assign to 'x' because it is a constant.
Solution:
let x = 10;
x = 20; // Correct usage with 'let'
In TypeScript (and modern JavaScript), variables declared with 'const' are read-only. If you need a variable that can be reassigned, use 'let'.