Interview Questions and Answers for 'Script' - 81 question(s) found - Order By Rating Q1. What is Array.Map function ? What will be output of following ?
const myArray = [1, 4, 9, 16];
const result = myArray.map(x => x * 2); Javascript
Ans. It will create an array with each value as x*2
[2, 8, 18, 32] Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Asked in 2 Companies Q2. 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   Q3. 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   Q4. 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   Q5. 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   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. No Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Q8. 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   Q9. 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   Q10. 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   Q11. 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   Q12. 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   Q13. Is it safe to use session storage ? Javascript
Ans. Session storage can be accessed from XSS (Cross site Scripting) attacks but cookies (if set with "HttpOnly" and "Secure" flags) are more safer against these attacks. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  session storage  security Q14. 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 Q15. How can print the whole object state in the console in javascript ? Javascript
Ans. We can JSON.stringify Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  javascript  angular Q16. What are the benefits of using UI framework like Angular , View js etc instead of plain vanilla js and html ? Javascript
Ans. These frameworks facilitates easier product development and enhancement and maintainability by having separation of concerns ( using oops ) and helps in development of reusable libraries / components. So in nutshell , they make development and maintenance of large scale application easier. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  Javascript Frameworks  Angular  View js Q17. Have you ever used sessionStorage ? What is the better way to store session information - sessionStorage or session cookie ? Session Management
Ans. Session Cookie, because session storage can be accessed from XSS (Cross site Scripting) attacks but cookies (if set with "HttpOnly" and "Secure" flags) are more safer against these attacks. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  SessionStorage  session cookie  session management  javascript Q18. what is strict mode in javascript ? How is it used ? Javascript
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   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 Q20. 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 Q21. 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 Q23. 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 Q24. 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 Q25. 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   Q26. 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 Q27. 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   Q28. 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   Q29. How is cohesion achieved in JavaScript ? JavaScript
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   Q30. 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