Seminar Topics & Project Ideas On Computer Science Electronics Electrical Mechanical Engineering Civil MBA Medicine Nursing Science Physics Mathematics Chemistry ppt pdf doc presentation downloads and Abstract

Full Version: JavaScript Interview Questions
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
[attachment=74709]



JavaScript interview questions and answers for provides a list of top 20 interview
questions. The frequently asked JavaScript interview questions with answers for
beginners and professionals are given below.
1) What is JavaScript?
JavaScript is a scripting language. It is different from Java language. It is objectbased,
lightweight and cross platform. It is widely used for client side validation.
More details...
2) What is the difference between JavaScript and jscript?
Netscape provided the JavaScript language. Microsoft changed the name and called it
JScript to avoid the trademark issue.In other words, you can say JScript is same as
JavaScript, but it is provided by Microsoft.
3) How to write a hello world example of JavaScript?
A simple example of JavaScript hello world is given below. You need to place it inside
the body tag of html.
1. <script type="text/javascript">
2. document.write("JavaScript Hello World!");
3. </script>
More details...
4) How to use external JavaScript file?
I am assuming that js file name is message.js, place the following script tag inside
the head tag.
1. <script type="text/javascript" src="message.js"></script>
More details...
5) Is JavaScript case sensitive language?

Yes.
6) What is BOM?
BOM stands for Browser Object Model. It provides interaction with the browser. The
default object of browser is window.
Browser Object Model
7) 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.
Document Object Model
8) 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.
More details...
9) 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.
1. history.back()
2. history.forward()
3. history.go(number): number may be positive for forward, negative for
backward.
More details...
10) How to write comment in JavaScript?
There are two types of comments in JavaScript.
1. Single Line Comment: It is represented by // (double forward slash)
2. Multi Line Comment: It is represented by slash with asterisk symbol as /* write



11) How to create function in JavaScript?
To create function in JavaScript, follow the following syntax.
1. function function_name(){
2. //function body
3. }
More details...
12) What are the JavaScript data types?
There are two types of data types in JavaScript:
1. Primitive Data Types
2. Non­primitive Data Types
More details...
13) 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.
14) How to write html code dynamically using JavaScript?
The innerHTML property is used to write the HTML code using JavaScript dynamically.
Let's see a simple example:
1. document.getElementById('mylocation').innerHTML="
<h2>This is heading using JavaScript</h2>";
More details...
15) How to write normal text code using JavaScript
dynamically?
The innerText property is used to write the simple text using JavaScript dynamically.
Let's see a simple example: