JavaScript Question and Answers
Q31 What is negative infinity?
Ans: It’s a number in JavaScript, derived by dividing negative number by
zero.
Q32:What boolean operators does JavaScript support?
aNS:- &&, || and !
Q33:What does "1"+2+4 evaluate to?
Ans: Since 1 is a string, everything is a string, so the result is 124.
Q34:How about 2+5+"8"?
Ans: Since 2 and 5 are integers, this is number arithmetic, since 8 is a
string, it’s concatenation, so 78 is the result.
Q35:What looping structures are there in JavaScript?
Ans:for, while, do-while loops, but no foreach.
Q36:How do you create a new object in JavaScript?
Ans: var obj = new Object(); or var obj = {};
Q37:How do you assign object properties?
Ans: obj["age"] = 17 or obj.age = 17.
Q38:What’s a way to append a value to an array?
Ans: arr[arr.length] = value;
Q39:What is this keyword?
Ans: It refers to the current object.
Q40:How can JavaScript make a Web site easier to use? That is, are there
certain JavaScript techniques that make it easier for people to use a Web site?
Ans: JavaScript's greatest potential gift to a Web site is that scripts can
make the page more immediately interactive, that is, interactive without having
to submit every little thing to the server for a server program to re-render the
page and send it back to the client. For example, consider a top-level
navigation panel that has, say, six primary image map links into subsections of
the Web site. With only a little bit of scripting, each map area can be
instructed to pop up a more detailed list of links to the contents within a
subsection whenever the user rolls the cursor atop a map area. With the help of
that popup list of links, the user with a scriptable browser can bypass one
intermediate menu page. The user without a scriptable browser (or who has
disabled JavaScript) will have to drill down through a more traditional and
time-consuming path to the desired content.
<<Previous
More>>
|