Variables: let and const
Prefer const, use let when a value changes and avoid var. TypeScript infers the type from the first value, so annotations are often optional.
Example
const name = "Ada";
let age = 21;
age = 22;
console.log(name, age);
// age = "x"; // error: string is not assignable to numberResult
Ada 22
Exercise
Constant keyword.
pi = 3.14;Quiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.