TypeScript - Interview Questions and Answers for 'Typescript' - 40 question(s) found - Order By Rating Q1. Will this code give any error ?
let result: string;
result = false || 'true'; Typescript
Ans. No Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Q2. Will this code give any error ?
let result: boolean | string;
result = false || 'true'; Typescript
Ans. No Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Q3. Will this code give any error ?
let result: boolean;
result = false || true; Typescript
Ans. No Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Q4. Will the following code give any error
let result: boolean;
result = false | true; Typescript
Ans. Yes, | is a bitwise operator and not boolean or. Use || instead Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Q5. Will the following code give any error
let result: string | number;
result = 'true'; Typescript
Ans. No Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Q6. Will the following code give any error
let result: string | number;
result = 'true'; Typescript
Ans. No Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Q7. Will the following code give any error
let result: string | number;
result = true; Typescript
Ans. Yes, result can either be string or a number but not boolean. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Q8. What does the following declaration mean
let result: string | number; Typescript
Ans. It means we can assign either a string or a number to result. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Q9. How can we specify that a particular variable may have either of the two data types in Typescript ? Typescript
Ans. Yes Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Q10. How can we specify that a particular variable may have either of the two data types in Typescript ? Typescript
Ans. let result: string | boolean; Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Q11. Can we specify that a particular variable may have either of the two data types in Typescript ? Typescript
Ans. let result: string | boolean; Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Q12. How can you trim all strings in an array ?
Ans. array.map(s => s.trim()) Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  java   angular   typescript   javascript This question was recently asked at 'Intelliware Development'.This question is still unanswered. Can you please provide an answer. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Asked in 1 Companies Q14. What are some downsides to static typing in TypeScript? TypeScript
This question was recently asked at 'Workday'.This question is still unanswered. Can you please provide an answer. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Asked in 1 Companies Q15. write an angular Typescript program to add item into an array TypeScript
This question was recently asked at 'Moneris'.This question is still unanswered. Can you please provide an answer. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Asked in 1 Companies This question was recently asked at 'Fuze'.This question is still unanswered. Can you please provide an answer. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Asked in 1 Companies Q17. What are the advantages of using TypeScript over Javascript ? TypeScript
This question was recently asked at 'Quicken Loans'.This question is still unanswered. Can you please provide an answer. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Asked in 1 Companies Q18. What new features of TypeScript do you like ? TypeScript
Ans. TypeScript is used to Apply types to your JavaScript code, And it shows the error in IDE while writing code and make us to fix it to avoid any bug or issue before build and deployment, for example: you put //@ts-code at top of your js file, and it will show errors in file when u make common code mistakes. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Asked in 1 Companies Q19. How can we make the constructor variables optional in Typescript ? TypeScript
Ans. Using "?" with the variables Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Q20. What is the role of "?" in TypeScript constructors ? TypeScript
This question is still unanswered. Can you please provide an answer. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  Typescript constructor Q21. How do we specify constructors in TypeScript ? How is it different from other languages ? TypeScript
This question is still unanswered. Can you please provide an answer. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Q22. How do we initialize objects in TypeScript ? TypeScript
Ans. Using new operator Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Q23. What is the difference between field and property in Typescript ? TypeScript
This question is still unanswered. Can you please provide an answer. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  field vs property in typescript Q24. What is the difference between method and function in Typescript ? TypeScript
Ans. Method belongs to a class whereas function isn't. So the only difference is the scope in which they are defined. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  method vs function in typescript Q25. Explain interfaces in Typescript. How is it different compared to other languages ? TypeScript
This question is still unanswered. Can you please provide an answer. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  interfaces in typescript Q26. What is arrow function in Typescript ? TypeScript
This question is still unanswered. Can you please provide an answer. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  arraow functions in typescript   lambda expression vs arrow function Q27. Can we do type casting in Typescript ? TypeScript
Ans. Yes Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  type casting in typescript Q28. What is the type of variable if we don't set any type ? TypeScript
Ans. Any Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  any type in typescript Q29. How is the declaration of enum in Typescript differ from Javascript ? TypeScript
This question is still unanswered. Can you please provide an answer. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  enum typescript  enum javascript Q30. Can we compile multiple type script files together ? How ? TypeScript
This question is still unanswered. Can you please provide an answer. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve