CoolInterview.com - 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
COOLINTERVIEW.COM WEB INTERVIEW QUESTIONS JAVA SCRIPT INTERVIEW QUESTIONS 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: CoolInterview.com
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)

document.getElementById("theDiv").style.vibility=hidden;

Source: CoolInterview.com
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: CoolInterview.com
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

cookies.txt

c:Program FilesNetscapeUsersusernamecookies.txt

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

c:WindowsCookiesusername@Website.txt
Source: CoolInterview.com
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.

Source: CoolInterview.com
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];
}

document.write("days["Monday"]:"+days["Monday"]);
</script>
This produces
days["Monday"]:Monday Source: CoolInterview.com
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: CoolInterview.com
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: CoolInterview.com
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: CoolInterview.com
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: CoolInterview.com
Question: Taking a developer?s perspective, do you think that that JavaScript is easy to learn and use?

Answer: One of the reasons JavaScript has the word "script" in it is that as a programming language, the vocabulary of the core language is compact compared to full-fledged programming languages. If you already program in Java or C, you actually have to unlearn some concepts that had been beaten into you. For example, JavaScript is a loosely typed language, which means that a variable doesn't care if it's holding a string, a number, or a reference to an object; the same variable can even change Source: CoolInterview.com
Question: What looping structures are there in JavaScript?

Answer: JavaScript supports the
for loop, while loop, do-while loop, but there is no foreach loop in JavaScript. Source: CoolInterview.com
Question: Can JavaScript code be broken in different lines?

Answer: Breaking is possible within a string statement by using a backslash at the end but not within any other javascript statement.
that is ,
document.write("Hello world");
is possible but not document.write
("hello world"); Source: CoolInterview.com
Question: How do you create a new object in JavaScript?

Answer: Create a new object in JavaScript

var obj = new Object();
//or
var obj = {}; Source: CoolInterview.com
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: CoolInterview.com
Question: How can JavaScript be used to improve the "look and feel" of a Web site? By the same token, how can JavaScript be used to improve the user interface?

Answer: On their own, Web pages tend to be lifeless and flat unless you add animated images or more bandwidth-intensive content such as Java applets or other content requiring plug-ins to operate (Shockwave and Flash, for example).

Embedding JavaScript into an HTML page can bring the page to life in any number of ways. Perhaps the most visible features built into pages recently with the help of JavaScript are the so-called image rollovers: roll the cursor atop a graphic image and its appearance c Source: CoolInterview.com
Question: What is the difference between undefined value and null value?

Answer: (i)Undefined value cannot be explicitly stated that is there is no keyword called undefined whereas null value has keyword called null.
(ii)typeof undefined variable or property returns undefined whereas typeof null value returns object. Source: CoolInterview.com
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: CoolInterview.com
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: CoolInterview.com
Question: How is JavaScript syntax like C / C++?

Answer: The languages have enough in common to make learning one easy if you know the other. By the same token, the differences are subtle enough to trip up those proficient in both. Here's a short list comparing C and JavaScript:

* Terminating JavaScript command lines in semicolons is optional; in C it's mandatory. Recommended practice is to use them religiously in both languages (and Java as well).
* Both JavaScript and C are case-sensitive; 'doThis' is different from Source: CoolInterview.com

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