Javascript Interview Questions and Answers – Part4

31. What are all the types of Pop up boxes available in JavaScript?

  • Alert
  • Confirm and
  • Prompt

32. What is the use of Void(0)?
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.

33. How can a page be forced to load another page in JavaScript?
The following code has to be inserted to achieve the desired effect:

<script language="JavaScript" type="text/javascript" >
<!-- location.href="http://newhost/newpath/newfile.html"; //--></script>

34. What is the data type of variables of in JavaScript?
All variables in the JavaScript are object data types.

35. What is the difference between an alert box and a confirmation box?
An alert box displays only one button which is the OK button.
But a Confirmation box displays two buttons namely OK and cancel.

36. What are escape characters?
Escape characters (Backslash) is used when working with special characters like single quotes, double quotes, apostrophes and ampersands. Place backslash before the characters to make it display.

document.write "I m a "good" boy"
document.write "I m a \"good\" boy"

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

38. What are the looping structures used in JavaScript?

  • For
  • While
  • Do—while
  • For each

39. Whether JavaScript has concept level scope?
No. JavaScript does not have concept level scope. The variable declared inside the function has scope inside the function.

40. What is the use of delete operator in JavaScript?
The delete operator is used to delete all the variables used in the program. It does not delete variables declared with the VAR keyword.

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 *

3 + three =

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