JavaScript Interview Questions

Section 1 - JavaScript Introduction

S.No Question
1. What is JavaScript? How JavaScript is different from java?
2. How to use JavaScript client side and server side?
3. What are the features of JavaScript?
4. Which JavaScript version you are using currently?
5. How Browser Execute the Javascript code?
6. Is JavaScript a case-sensitive language?
7. What is call stack? How call stack work? What is meaning of global execution context?
8. What do you thing javascript is single threaded or multithreaded scripting language?
9. What are the advantages of JavaScript?
10. Name some of the built-in methods and the values returned by them.
11. Name some of the JavaScript Frameworks.
12. What are Exports & Imports?
Section 2 - Operators and varaible

S.No Question
1. What are the operators in javascript? How many types of operators?
2. Tell me any operator in javascript which is not present is c or cpp or java or python?
3. What is difference between == and === operator in js?
4. Can you multiply and divide any integer by 2 without using arithmetic operator?
5. Exchange two values without using third variable and without using arithmetic operator?
6. Explain Datatypes supported by javascript?
7. What is difference between undefined and null?
8. Where to use undefined and where to use null?
9. How to define variable in javascript?
10. var v/s let v/s const?
11. What is hoisting in javascript?
12. What will be result of following two statment?
a. undefined == null
b. undefined === null
13. How can you create an object in JavaScript?
14. What are the scopes of a variable in JavaScript?
15. What are the variable naming conventions in JavaScript?
16. How does TypeOf Operator work?
17. What are the ways to define a variable in JavaScript?
18. What is a Typed language?
19. What is the difference between Local storage & Session storage?
20. What is the difference between undeclared & undefined?
21. What is the difference between window & document in JavaScript?
22. What is the difference between innerHTML & innerText?
23. What is NaN in JavaScript?
24. How do JavaScript primitive/object types passed in functions?
25. How can you convert the string of any base to integer in JavaScript?
26. What is a prompt box in JavaScript?
27. What will be the output of the following code?
var Employee = {
company: 'xyz'
};
var Emp1 = Object.create(Employee);
delete Emp1.company;
console.log(Emp1.company);
28. What will be the output of the code below?
//nfe (named function expression)
var Foo = Function Bar()
{
return 7;
};
typeof Bar();
Section 3 - If and Switch Statement

S.No Question
1. How many ways to execute statement conditionally in javascript?
2. Write A Javascript syntax to make use of nested if-else statement?
3. What is difference between if and switch statement? Where to use if and where to use switch?
4. What is javascript program to check given number is even or odd using switch case?
5. Is it mandatory to make use of default case in switch statement?
6. Can we make default case first statement in switch case?
7. Can we use variable expression as case label?
Section 4 - Loop Statement

S.No Question
1. What is iterative problem and how to solve it in javascript?
2. How many types of loop in javascript?
3. What are the differences between while and do-while?
4. Can you write a syntax of for loop in which it work like as while loop?
5. How for in and for of works? Explain with the help of example?
6. What are the differences between for in and for of loop?
7. Can we iterate array in javascript?
Section 5 - Functions Basics

S.No Question
1. What is function? Why to use function? What are the advantage of using function in javascript?
2. How many way to define function in javascript?
3. How to pass data and return data to/from the function?
4. What is arrow function in js?
5. What is callback and error callback?
6. What is callback hell? Eplain with the help of example? How to overcome callback hell?
7. What is function expression, function statement explain with help of example?
8. What is difference between function expression and function statement?
9. What is a name function in JavaScript & how to define it.
10. Can you assign an anonymous function to a variable and pass it as an argument to another function?
11. What is argument objects in JavaScript & how to get the type of arguments passed to a function?
12. What is Callback?
13. What is Closure? Give an example.
14. What is the ‘Strict’ mode in JavaScript and how can it be enabled?
15. What is the reason for wrapping the entire content of a JavaScript source file in a function book?
16. What is the difference between Call & Apply?
17. What will be the output of the following code?
var output = (function(x) {
delete x;
return x;
})(0);
console.log(output);
18. What will be the output of the following code?
var Output = (function() {
delete X.foo;
return X.foo;
})();
console.log(output);
19. Explain setInterval(), setTimeout(), clearInterval(), clearTimeout().
Section 6 - Events

S.No Question
1. What is events in javascript?
2. Tell us the name of any 5 event in javascript?
3. How to apply click event on html dom element by using javascript code (not to use onclick on dom element)?
4. What is addEventListener?
5. What is event bubbling and event capturing?
6. onclick, ondblclick, onkeyup, onkeypress , onchange, onblur explain with example.
7. What is this Keyword in JavaScript?
8. What is an event bubbling in JavaScript?
Section 7 - Document Object Model (Dom)

S.No Question
1. What is DOM?
2. Create funtionality to show and hide password.
3. Write a javascript program to swap to images on button click?
4. Perform the addition of two number using js?
5. How to apply css class and remove css class from a particular dom element?
6. Write javascript code to validate the signup field (username,email,password, mobile,qualification-list.)?
7. List out the different ways an DOM element can be accessed in javascript?
8. How to create a cookie using JavaScript?
9. How to read a cookie using JavaScript?
10. How to delete a cookie using JavaScript?
11. What is the difference between Attributes and Property?
12. List out the different ways an HTML element can be accessed in a JavaScript code.
13. In how many ways a JavaScript code can be involved in an HTML file?
Section 8 - Array and Arrays Function

S.No Question
1. What is an array in javascript?
2. When to use an array concept?
3. How can you create an Array in JavaScript?
4. How to empty an Array in JavaScript?
Section 9 - Strings

S.No Question
1. What would be the result of 2+5+”3″?
2. What are escape characters in JavaScript?

Contact Us

Our Address

Plot No. 64, PU-4, Scheme 54, Behind C21 Mall near Hotel Holiday , AB Road, Indore Pin-code:452001

Email Us

contact@codebetter.in

Call Us

+91 88230 75444, +91 99939 28766

Loading
Your message has been sent. Thank you!