I am assuming that js file name is message.js, place the following script tag inside the head tag.
What is BOM?
BOM stands for Browser Object Model. It provides interaction with the browser. The default object of browser is window.
What is DOM? What is the use of document object?
DOM stands for Document Object Model. A document object represent the html document. It can be used to access and change the content of html.
What is the use of window object?
The window object is automatically created by the browser that represents a window of a browser.
It is used to display the popup dialog box such as alert dialog box, confirm dialog box, input dialog box etc.
What is the use of history object?
The history object of browser can be used to switch to history pages such as back and forward from current page or another page. There are three methods of history object.
history.go(number): number may be positive for forward, negative for backward.
Single Line Comment: It is represented by // (double forward slash)
Multi Line Comment: It is represented by slash with asterisk symbol as /* write comment here */
Primitive Data Types
Non-primitive Data Types
What is the difference between == and ===?
The == operator checks equality only whereas === checks equality and data type i.e. value must be of same type.
By object literal
By creating instance of Object
By Object Constructor
Let's see a simple code to create object using object literal.
By array literal
By creating instance of Array
By using an Array constructor
Let's see a simple code to create array using object literal.
What does the isNaN() function?
The isNan() function returns true if the variable value is not a number.
3030 because 10+20 will be 30. If there is numeric value before and after +, it is treated is binary + (arithmetic operator).
102030 because after a string all the + will be treated as string concatenation operator (not binary +).
In which location cookies are stored on the hard disk?
The storage of cookies on the hard disk depends on OS and the browser.
The Internet Explorer stores the cookies on a file firstname.lastname@example.org. The path is: c:\Windows\Cookies\username@Website.txt.
What is the difference between undefined value and null value?
Undefined value: A value that is not defined and has no keyword is known as undefined value. For example:
int number;//Here, number has undefined value.
Null value: A value that is explicitly specified by the keyword "null" is known as null value. For example:
String str=null;//Here, str has a null value.
window.document.body.style.cursor = "wait";
What is this?
var myArray = [[]];
Three dimensional array.
What is negative infinity?
What is difference between View state and Session state?
"View state" is specific to a page in a session whereas "Session state" is specific to a user or browser that can be accessed across all pages in the web application.
The navigator.appVersion string can be used to detect the operating system on the client machine.
<form name="myform" action="index.php">
Search: <input type='text' name='query' />
Yes, because it doesn't require web server's support for execution.