JavaScript Interview Questions
1 .
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.
2 .
How to create objects in JavaScript ?
There are 3 ways to create object in JavaScript.

By object literal
By creating instance of Object
By Object Constructor

Let's see a simple code to create object using object literal.

Ex : emp={id:100,name:"Free Time Learn",salary:45000} 
3 .
Difference between Client side JavaScript and Server side JavaScript ?
Client side JavaScript comprises the basic language and predefined objects which are relevant to running java script in a browser. The client side JavaScript is embedded directly by in the HTML pages. This script is interpreted by the browser at run time.

Server side JavaScript also resembles like client side java script. It has relevant java script which is to run in a server. The server side JavaScript are deployed only after compilation.
4 .
How to set the cursor to wait in JavaScript ?
The cursor can be set to wait in JavaScript by using the property "cursor". The following example illustrates the usage : 

<script type="text/javascript"> = "wait"; 
5 .
What is callback ?
A callback is a plain JavaScript function passed to some method as an argument or option. Some callbacks are just events, called to give the user a chance to react when a certain state is triggered.
6 .
What is closure ?
Closures are created whenever a variable that is defined outside the current scope is accessed from within some inner scope.
7 .
Can you access Cookie using javascript ?
JavaScript can also manipulate cookies using the cookie property of the Document object. JavaScript can read, create, modify, and delete the cookie or cookies that apply to the current web page. 
8 .
How to create a Cookie using JavaScript ?
The simplest way to create a cookie is to assign a string value to the document.cookie object, which looks like this  :

Syntax  :  document.cookie = "key1 = value1; key2 = value2; expires = date";
9 .
How to redirect a url using JavaScript ?
His is very simple to do a page redirect using JavaScript at client side. To redirect your site visitors to a new page, you just need to add a line in your head 
Section as follows :
  <script type="text/javascript">
10 .
What is purpose of onError event handler in JavaScript ?
The onerror event handler provides three pieces of information to identify the exact nature of the error :

Error message : The same message that the browser would display for the given error.
URL : The file in which the error occurred.
Line number : The line number in the given URL that caused the error.