JavaScript Interview Questions
1 .
Which keywords are used to handle exceptions?
Try… Catch---finally is used to handle exceptions in the JavaScript
 
Try{
	Code
}
Catch(exp){
	Code to throw an exception
}
Finally{
	Code runs either it finishes successfully or after catch
}
2 .
What is the use of blur function?
Blur function is used to remove the focus from the specified object.
3 .
How to find operating system in the client machine using JavaScript?
The 'Navigator.appversion' is used to find the name of the operating system in the client machine.
4 .
What are the different types of errors in JavaScript?
There are three types of errors :
 
Load time errors : Errors which come up when loading a web page like improper syntax errors are known as Load time errors and it generates the errors dynamically.

Run time errors : Errors that come due to misuse of the command inside the HTML language.

Logical Errors : These are the errors that occur due to the bad logic performed on a function which is having different operation.
5 .
What is the use of Push method in JavaScript?
The push method is used to add or append one or more elements to the end of an Array. Using this method, we can append multiple elements by passing multiple arguments
6 .
What is the difference between JavaScript and Jscript?
Both are almost similar. JavaScript is developed by Netscape and Jscript was developed by Microsoft .
7 .
What is the 'Strict' mode in JavaScript and how can it be enabled?
Strict Mode adds certain compulsions to JavaScript. Under the strict mode, JavaScript shows errors for a piece of codes, 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. This can be illustrated by the given example:
 
function myfunction() {
    "use strict";
    var v = "This is a strict mode function";
}
8 .
What is the significance of, and reason for, wrapping the entire content of a JavaScript source file in a function block?
This is an increasingly common practice, employed by many popular JavaScript libraries (jQuery, Node.js, etc.). This technique creates a closure around the entire contents of the file which, perhaps most importantly, creates a private namespace and thereby helps avoid potential name clashes between different JavaScript modules and libraries.
 
Another feature of this technique is to allow for an easily referenceable (presumably shorter) alias for a global variable. This is often used, for example, in jQuery plugins. jQuery allows you to disable the $ reference to the jQuery namespace, using jQuery.noConflict(). If this has been done, your code can still use $ employing this closure technique, as follows:
 
(function($) { /* jQuery plugin code referencing $ */ } )(jQuery);
9 .
What is the DOM?
DOM stands for Document Object Model is an interface (API) for HTML and XML documents. When the browser first reads (parses) our HTML document it creates a big object, a really big object based on the HTML document this is the DOM. It is a tree-like structure that is modeled from the HTML document. The DOM is used for interacting and modifying the DOM structure or specific Elements or Nodes.
 
<!DOCTYPE html>
<html lang="en">

<head>
   <meta charset="UTF-8">
   <meta name="viewport" content="width=device-width, initial-scale=1.0">
   <meta http-equiv="X-UA-Compatible" content="ie=edge">
   <title>Document Object Model</title>
</head>

<body>
   <div>
      <p>
         <span></span>
      </p>
      <label></label>
      <input>
   </div>
</body>

</html>
 
The document object in JavaScript represents the DOM. It provides us many methods that we can use to selecting elements to update element contents and many more.
10 .
What is the way to get the status of a CheckBox?
The status can be acquired as follows  : 
 
alert(document.getElementById('checkbox1').checked);
 
If the CheckBox will be checked, this alert will return TRUE.