Get Latest Exam Updates, Free Study materials and Tips

JAVA Script Interview Questions

1.What is JavaScript?
Ans: JavaScript is a client-side as well as a server-side scripting language that can be inserted into HTML pages and is understood by web browsers. JavaScript is also an Object-based Programming language.

2. What are JavaScript Data Types?
Ans: Following are the JavaScript Data types: Number String Boolean Function Object Undefined

3. What is the use of the isNaN function?
Ans: isNan function returns true if the argument is not a number otherwise, it is false.

4.What is negative infinity?
Ans: Negative Infinity is a number in JavaScript that can be derived by dividing the negative number by zero.

5.Which company developed JavaScript?
Ans: Netscape is the software company that developed JavaScript.

6. What are undeclared and undefined variables?
Ans: Undeclared variables are those that do not exist in a program and are not declared. If the program tries to read the value of an undeclared variable, then a runtime error is encountered. Undefined variables are those that are declared in the program but have not been given any value. If the program tries to read the value of an undefined variable, an undefined value is returned.

7. What is this’ keyword in JavaScript?
Ans: ‘this’ keyword refers to the object from where it was called.

8.What is an operator?
Ans: is called a strict equality operator which returns true when the two operands are having the same value without any type conversion.

9. Does JavaScript support automatic type conversion?
Ans: Yes JavaScript does support automatic type conversion, it is the common way of type conversion used by JavaScript developers.

10. Explain the difference between “e” and
Ans: “ea checks only for equality in value whereas “a” is a stricter equality test and returns false if either the value or the type of the two variables are different.

11. What would be the result of 3+2+”7″?
Ans: Since 3 and 2 are integers, they will be added numerically. And since 7 is a string, its concrete will be done. So the result would be 57.

12. What do mean by NULL in Javascript?
Ans: The NULL value is used to represent no value or no object. It implies no object or null string, no valid boolean value, no number and no array object.

13. What is the function of the delete operator?
Ans: The delete keyword is used to delete the property as well as its value.
Example
var student (age:20, batch:”ABC”);
delete student.age;

14. What is an undefined value in JavaScript?
Ans: Undefined value means the
Variable used in the code doesn’t exist
Variable is not assigned to any value
The property doesn’t exist

15. What are all the types of Pop up boxes available in JavaScript?
Ans: Alert, Confirm and Prompt

16.What is the use of Void(0)?
Ans: Void(0) is used to prevent the page from refreshing and parameter “zero” is passed while calling.
Void(0) is used to call another method without refreshing the page.

17. What is the data type of variables in JavaScript?
Ans: All variables in JavaScript are object data types.

18. What are JavaScript Cookies?
Ans: Cookies are small text files stored in a computer and it gets created when the user visits the websites to store information that they need. An example could be User Name details and shopping cart information from the previous visits.

19. How generic objects can be created?
Ans: Generic objects can be created as:
var i= new object():

20. What is the use of a type of operator?
Ans: ‘Typeof’ is an operator which is used to return a string description of the type of a variable.

21. How are object properties assigned?
Ans: Properties are assigned to objects in the following way
obj[‘class’] = 12; obj.class = 12;

22. What is the ‘Strict mode in JavaScript and how can it be enabled?
Ans: Strict Mode adds certain compulsions to JavaScript. Under the strict mode, JavaScript shows errors for a piece of code, which did not show an error before, but might be problematic and potentially unsafe. Strict mode also solves some mistakes that hamper the JavaScript engines to work efficiently. Strict mode can be enabled by adding the string literal “use strict” above the file.

23. How will you explain closures in JavaScript? When are they used?
Ans: Closure is a locally declared variable related to a function that stays in memory when the function has returned.

24. Explain the for-in loop?
Ans: The for-in loop is used to loop through the
properties of an object.
for (variable name in object){
statement or block to execute
}

25. What is the difference between.call() and apply0?
Ans: The function.call() and .apply() are very similar in their usage except a little difference..call() is used when the number of the function’s arguments are known to the programmer, as they have to be mentioned as arguments in the call statement. On the other hand, .apply() is used when the number is not known. The function.apply() expects the argument to be an array.
The basic difference between .call and.apply( is in the way arguments

Prepare For Your Placements: https://lastmomenttuitions.com/courses/placement-preparation/

/ Youtube Channel: https://www.youtube.com/channel/UCGFNZxMqKLsqWERX_N2f08Q

Follow For Latest Updates, Study Tips & More Content!

/lastmomenttuition

/ Last Moment Tuitions

/ lastmomentdost