What is the correct syntax to annotate a variable `age` as a number in TypeScript?

TypeScript Associate Easy

TypeScript Associate — Easy

What is the correct syntax to annotate a variable `age` as a number in TypeScript?

Key points

  • TypeScript uses the colon (:) to specify variable types
  • The keyword `number` indicates that `age` should be a number type
  • Incorrect syntax like `let age = number;` does not correctly annotate the variable

Ready to go further?

Related questions