TypeScript - Interview Questions and Answers for 'TypeScript' | Search Interview Question - javasearch.buggybread.com
Javasearch.buggybread.com

Search Interview Questions


 More than 3000 questions in repository.
 There are more than 900 unanswered questions.
Click here and help us by providing the answer.
 Have a video suggestion.
Click Correct / Improve and please let us know.
Label / Company      Label / Company / Text

   



Interview Questions and Answers - Order By Newest

   
 Q31. 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     


 Q32. 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     


 Q33. 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     


 Q34. 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     


 Q35. 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     


 Q36. 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     


 Q37. 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     


 Q38. 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     


 Q39. 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     


 Q40. 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     


previous 30   

Help us and Others Improve. Please let us know the questions asked in any of your previous interview.

Any input from you will be highly appreciated and It will unlock the application for 10 more requests.

Company Name:
Questions Asked: