- World's Largest Collection of Interview Questions & Answers, FAQs, queries, sample papers, exam papers, dumps, what, why, how, where, when questions
Our Services
Get 9,000 Interview Questions & Answers in an eBook.

Get it now !!
Send your Resume to 6000 Companies
Java Script Interview Questions & Answers - Learning Mode

Java Script Interview Questions & Answers - Learning Mode

Javascript is a dynamic computer programming language. It is lightweight and most commonly used as a part of web pages, whose implementations allow client-side script to interact with the user and make dynamic pages. It is an interpreted programming language with object-oriented capabilities. JavaScript is a cross-platform, object-oriented scripting language. It is a small and lightweight language. Inside a host environment (for example, a web browser), JavaScript can be connected to the objects of its environment to provide programmatic control over them.

Try Java Script Interview Questions & Answers - Exam Mode

1 2 3 4 5 6 7 8 9 10 11 12 Next

Sort By : Latest First | Oldest First | By Rating

Java Script Interview Questions & Answers - Learning Mode
Try Java Script Interview Questions & Answers - Exam Mode
Question: How do you target a specific frame from a hyperlink?

Answer: Include the name of the frame in the target attribute of the hyperlink. <a href=?mypage.htm? target=?myframe?>>My Page</a> Source:
Question: What is the difference between an alert box and a confirmation box?

Answer: An alert box displays only one button which is the OK button whereas the Confirm box

displays two buttons namely OK and cancel. Source:
Question: How do you convert numbers between different bases in JavaScript?

Answer: Use the parseInt() function, that takes a string as the first parameter, and the base as a second parameter. So to convert hexadecimal 3F to decimal, use parseInt ("3F", 16); Source:
Question: How can we hide HTML source code from users? This website is created with Java Script language.

Answer: put the HTML in a <div id="theDiv"> tag
call the javascript function in any event like (onLoad ,onClick etc)


Question: How to test for bad numbers using JavaScript?

Answer: The global method, "isNaN()" can tell us about value if a number has gone bad in JavaScript.

var temperature = parseFloat(myTemperatureWidget.value);

if(!isNaN(temperature)) {
alert("Please enter a valid temperature.");
} Source:
Question: Where are cookies actually stored on the hard disk?

Answer: This depends on the user's browser and OS.
In the case of Netscape with Windows OS,all the cookies are stored in a single file called


c:Program FilesNetscapeUsersusernamecookies.txt

In the case of IE,each cookie is stored in a separate file namely username@website.txt.

Question: What is the ?Strict? mode in JavaScript and how can it be enabled ?

Answer: 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"; Source:
Question: How to use strings as array indexes using JavaScript?

Answer: Javascript does not have a true hashtable object, but through its wierdness, you can use the array as a hashtable.

<script type="text/javascript">
var days = ["Sunday","Monday","Tuesday","Wednesday", "Thursday","Friday","Saturday"];

for(var i=0; i < days.length; i++) {
days[days[i]] = days[i];

This produces
days["Monday"]:Monday Source:
Question: How to disable an HTML object?

Answer: To disable an HTML object in JavaScript use below line of code...

document.getElementById("myObject").disabled = true; Source:
Question: How about 2+5+"8"?

Answer: Since 2 and 5 are integers, this is number arithmetic, since 8 is a string, it?s concatenation, so 78 is the result. Source:
Question: What does undefined value mean in JavaScript?

Answer: Undefined value means the variable used in the code doesn't exist or is not assigned any value or the property doesn't exist Source:
Question: Are you concerned that older browsers don't support JavaScript and thus exclude a set of Web users? individual users?

Answer: Fragmentation of the installed base of browsers will only get worse. By definition, it can never improve unless absolutely everyone on the planet threw away their old browsers and upgraded to the latest gee-whiz versions. But even then, there are plenty of discrepancies between the scriptability of the latest Netscape Navigator and Microsoft Internet Explorer.
The situation makes scripting a challenge, especially for newcomers who may not be aware of the limitations of earlier browsers. A lot Source:
Question: How do you create a new object in JavaScript?

Answer: Create a new object in JavaScript

var obj = new Object();
var obj = {}; Source:
Question: Explain functions as methods?

Answer: There is no big distinction between function definition and method definition. The only difference occurs when you actually call that function as a method which inturn is attached to an object. When the function is called in this manner its local keyword is bound to that object. Source:
Question: How to detect the operating system on the client machine?

Answer: In order to detect the operating system on the client machine, the navigator.appVersion

string (property) should be used.

Question: Explain about arrays in Java Script?

Answer: Array maps everything from an integer to Values. Objects map everything from values to integers, Javascript specialize in certain special functions through which they can include integer indicies in their behavior. Large indicies can be removed if the length of the array specified is very small. Source:
Question: How do you target a specific frame from a hyperlink?

Answer: Include the name of the frame in the target attribute of the hyperlink. <a href=?mypage.htm? target=?myframe?>>My Page</a> Source:
Question: What can javascript programs do?

Answer: Generation of HTML pages on-the-fly without accessing the Web server. The user can be given control over the browser like User input validation Simple computations can be performed on the client's machine The user's browser, OS, screen size, etc. can be detected Date and Time Handling Source:
Question: What are the problems associated with using JavaScript, and are there JavaScript techniques that you discourage?

Answer: Browser version incompatibility is the biggest problem. It requires knowing how each scriptable browser version implements its object model. You see, the incompatibility rarely has to do with the core JavaScript language (although there have been improvements to the language over time); the bulk of incompatibility issues have to do with the object models that each browser version implements. For example, scripter who started out with Navigator 3 implemented the image rollover because it looked c Source:
Question: Explain unescape() and escape() in JavaScript?

Answer: These are similar to the decodeURI() and encodeURI(), but escape() is used for only portions of a URI.

<script type="text/javascript">
var myvalue = "Sir Robbert Scott";
document.write("Original myvalue: "+myvalue);
document.write("<br />escaped: "+escape(myvalue));
document.write("<br />uri part: "&author="+escape(myvalue)+""");

If you use escape() for the whole URI... well bad things happen.
<script type="text/javascript"> Source:

1 2 3 4 5 6 7 8 9 10 11 12 Next

India News Network
Latest 20 Questions
Payment of time- barred debt is: (a) Valid (b) Void (c) Illegal (d) Voidable
Consideration is defined in the Indian Contract Act,1872 in: (a) Section 2(f) (b) Section 2(e) (c) Section 2(g) (d) Section 2(d)
Which of the following is not an exception to the rule, "No consideration, No contract": (a) Natural love and affection (b) Compensation for involuntary services (c) Completed gift (d) Agency
Consideration must move at the desire of: (a) The promisor (b) The promisee (c) The promisor or any other party (d) Both the promisor and the promisee
An offer which is open for acceptance over a period of time is: (a) Cross Offer (b) Counter Offer (c) Standing Offer (d) Implied Offer
Specific offer can be communicated to__________ (a) All the parties of contract (b) General public in universe (c) Specific person (d) None of the above
_________ amounts to rejection of the original offer. (a) Cross offer (b) Special offer (c) Standing offer (d) Counter offer
A advertises to sell his old car by advertising in a newspaper. This offer is caleed: (a) General Offer (b) Special Offer (c) Continuing Offer (d) None of the above
In case a counter offer is made, the original offer stands: (a) Rejected (b) Accepted automatically (c) Accepted subject to certain modifications and variations (d) None of the above
In case of unenforceable contract having some technical defect, parties (a) Can sue upon it (b) Cannot sue upon it (c) Should consider it to be illegal (d) None of the above
If entire specified goods is perished before entering into contract of sale, the contract is (a) Valid (b) Void (c) Voidable (d) Cancelled
______________ contracts are also caled contracts with executed consideration. (a) Unilateral (b) Completed (c) Bilateral (d) Executory
A offers B to supply books @ Rs 100 each but B accepts the same with condition of 10% discount. This is a case of (a) Counter Offer (b) Cross Offer (c) Specific Offer (d) General Offer
_____________ is a game of chance. (a) Conditional Contract (b) Contingent Contract (c) Wagering Contract (d) Quasi Contract
There is no binding contract in case of _______ as one's offer cannot be constructed as acceptance (a) Cross Offer (b) Standing Offer (c) Counter Offer (d) Special Offer
An offer is made with an intention to have negotiation from other party. This type of offer is: (a) Invitation to offer (b) Valid offer (c) Voidable (d) None of the above
When an offer is made to the world at large, it is ____________ offer. (a) Counter (b) Special (c) General (d) None of the above
Implied contract even if not in writing or express words is perfectly _______________ if all the conditions are satisfied:- (a) Void (b) Voidable (c) Valid (d) Illegal
A specific offer can be accepted by ___________. (a) Any person (b) Any friend to offeror (c) The person to whom it is made (d) Any friend of offeree
An agreement toput a fire on a person's car is a ______: (a) Legal (b) Voidable (c) Valid (d) Illegal
Cache = 0.03125 Seconds