JavaScript - Interview Questions and Answers for 'JavaScript' - 35 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 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 Q3. 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 Q4. 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 Q5. 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 Q6. 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 Q7. 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   Q8. 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   Q9. How Object-Oriented Programming is implemented in JavaScript? How they differ from other languages? 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  object oriented programming in javascript  oops in javascript Q10. 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 Q11. What are benefits of strongly typing variables ? 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  strong typing javascript Q12. Difference between Let and Var in Javascript ? JavaScript
Ans. Var scopes the variable to the nearest function whereas Let scopes the variable to nearest block.
For example -
function printNumbers() {
for(var i = 1; i < 3: i++){
console.log(i);
}
console.log(i); // works fine and will print 3 as i has a function scope and not local loop scope
} Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  let vs var in javascript  let vs var   difference between let and var Q13. prototypal inheritance in Javascript JavaScript
This question was recently asked at 'RocketMiles'.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. Have you had to work with memory leak problems in javascript ? JavaScript
This question was recently asked at 'RockYou'.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 a method to track every click on a page. JavaScript
This question was recently asked at 'LinkedIn'.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 Q16. What is the difference between inheritance in PHP vs. Javascript? JavaScript
This question was recently asked at 'WePay'.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  php  javascript Asked in 1 Companies 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 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   Q19. What does 'variable hoisting' mean? JavaScript
Ans. 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 is the use of this keyword in javascript ? Javascript
Ans. This keyword refers to the current instance of the class. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Asked in 1 Companies Q21. What is type script ? What are the advantages of typescript ? How is it different than 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  Typescript vs JavascriptAns. == compares values === is used in scripting languages for comparing two values as well as there data tpe. like in js,php. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  ==  ===  == vs === Asked in 13 Companies basic   frequent Ans. Possible Answer - I use either Firebug or Chrome Developer tool. 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 is the difference between Java OR operator and Java script OR operator ? JavaScript
This question was recently asked at 'Symantec'.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 Q25. Which statement is used to exit a function in java script ? JavaScript
Ans. return Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Asked in 1 Companies Q26. How can java script access a database ? JavaScript
This question was recently asked at 'American Express'.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 'American Express'.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 Q28. How would you choose your favorite company name for e.g. three companies are given in radio buttons Infosys, TCS and Aricent. Do You need to loop trough all radio buttons and select your favorite company or can just get the selected value. 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   Q29. Difference between Scriptlet and JSTL. Javascript
This question was recently asked at 'Hexaware'.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 Q30. What are falsy attributes in javascript ? Javascript
Ans. A falsy value is something which evaluates to FALSE, for instance when checking a variable. There are only six falsey values in JavaScript: undefined, null, NaN, 0, "" (empty string), and false of course. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve