TypeScript Syntax
TypeScript is a superset of JavaScript, so every JavaScript program is valid. Add type annotations after a colon. Comments use // and /* */. Types disappear after compilation.
Example
// comment
let x: number = 10; /* inline */
console.log(x);Result
10
Exercise
Annotate with this symbol.
let n number = 1;
Quiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.