Javascript Interview Questions and Answers – Part3

21. Define the occurrence of negative infinity in JavaScript?
Negative infinity is a special number which comes up when a negative number is divided by zero.

 22. What are all the looping structures in JavaScript?
Following are looping structures in Javascript:

  • For
  • While
  • do-while loops

23. What is called Variable typing in Javascript?
Variable typing is used to assign a number to a variable and the same variable can be assigned to a string.

i = 10;
i = "string";

This is called variable typing.

24. How can you convert the string of any base to integer in JavaScript?
The parseInt() function is used to convert numbers between different bases. parseInt() takes the string to be converted as its first parameter, and the second parameter is the base of the given string.
In order to convert 4F (of base 16) to integer, the code used will be –

parseInt ("4F", 16);

25. Explain the difference between “==” and “===”?
“==” checks only for equality in value whereas “===” is a stricter equality test and returns false if either the value or the type of the two variables are different.

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

27. How can we append a value to an array?
Array value can be appended by arr[arr.length] = value;

28. What do mean by NULL in Javascript?
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.

29. What is the function of delete operator?
The functionality of delete operator is used to delete all variables and objects in a program but it cannot delete variables declared with VAR keyword.

30. What is an undefined value in JavaScript?
Undefined value means the

  • Variable used in the code doesn’t exist
  • Variable is not assigned to any value
  • Property doesn’t exist
Sign-up for our email newsletter and get free job alerts, current affairs and GK updates regularly.
Subscribe Here (or)

Leave a Reply

Your email address will not be published. Required fields are marked *

eight + 5 =

Popup Dialog Box Powered By :
  • RSS
  • Facebook
  • Google+
  • Twitter