637 B
Executable File
637 B
Executable File
const and Assignment
TypeScript uses const, let, and var for variable declarations. Modern code usually prefers const and let.
const
const apiBase = 'https://example.com';
constmeans the binding cannot be reassigned.- You can still mutate object contents unless frozen.
const config = { retries: 2 };
config.retries = 3; // allowed
// config = {}; // not allowed
Assignment Operator =
let count = 0;
count = count + 1;
=assigns a new value to a variable.
Python Comparison
Python has no enforced const; TypeScript enforces no-reassign when const is used.