How to create a variable in typescript?



How to create a variable in typescript?..

Answer / Mithilesh Mishra

To create a variable in TypeScript, use the var, let or const keywords followed by the variable name and its type (if not inferable). Here's an example:n```typescriptnlet myVariable: number = 10;nconst anotherVariable: string = 'Hello World';``"`

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More TypeScript Interview Questions

What is namespace in typescript?

1 Answers  


What is the difference between the internal and external module in typescript?

1 Answers  


What are typescript public, private, protected and readonly modifiers?

1 Answers  


What is super in typescript?

1 Answers  


What is the difference between the internal module and the external module?

1 Answers  


What is components in typescript?

1 Answers  


What is named function?

1 Answers  


List the built-in types in typescript.

1 Answers  


What is the callback function in typescript?

1 Answers  


How does typescript support optional parameters in function as in javascript every parameter is optional for a function?

1 Answers  


What is optional properties in typescript?

1 Answers  


Tell the minimum requirements for installing typescript. Also, mention the steps involved in it.

1 Answers  


Categories