Java Script Interview Questions and Answers
Question - 21 : - Are you concerned that older browsers don't support JavaScript and thus exclude a set of Web users? individual users?
Answer - 21 : - 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 of effort in my books and ancillary material goes toward helping scripters know what features work in which browsers and how to either workaround limitations in earlier browsers or raise the compatibility common denominator.
Designing scripts for a Web site requires making some hard decisions about if, when, and how to implement the advantages scripting offers a page to your audience. For public Web sites, I recommend using scripting in an additive way: let sufficient content stand on its own, but let scriptable browser users receive an enhanced experience, preferably with the same HTML document.
Question - 22 : - What does isNaN function do?
Answer - 22 : - Return true if the argument is not a number.
Question - 23 : - In a pop-up browser window, how do you refer to the main browser window that opened it?
Answer - 23 : - Use window.opener to refer to the main window from pop-ups.
Question - 24 : - What is negative infinity?
Answer - 24 : - It’s a number in JavaScript, derived by dividing negative number by zero.
Question - 25 : - What is the data type of variables of in JavaScript?
Answer - 25 : - All variables are of object type in JavaScript.
Question - 26 : - Methods GET and POST in HTML forms - what's the difference?
Answer - 26 : - GET: Parameters are passed in the querystring. Maximum amount of data that can be sent via the GET method is limited to about 2kb.
POST: Parameters are passed in the request body. There is no limit to the amount of data that can be transferred using POST. However, there are limits on the maximum amount of data that can be transferred in one name/value pair.
Question - 27 : - Text From Your Clipboard?
Answer - 27 : - It is true, text you last copied for pasting (copy & paste) can be stolen when you visit web sites using a combination of JavaScript and ASP (or PHP, or CGI) to write your possible sensitive data to a database on another server.
Question - 28 : - What does the "Access is Denied" IE error mean?
Answer - 28 : - The "Access Denied" error in any browser is due to the following reason.
A javascript in one window or frame is tries to access another window or frame whose document's domain is different from the document containing the script.
Question - 29 : - How to write a script for "Select" lists using javascript?
Answer - 29 : - 1. To remove an item from a list set it to null
mySelectObject.options[3] = null;
2. To truncate a list set its length to the maximum size you desire
mySelectObject.length = 2;
3. To delete all options in a select object set the length to 0.
mySelectObject.leng
Question - 30 : - Is a javascript script faster than an ASP script?
Answer - 30 : - Yes.Since javascript is a client-side script it does require the web server's help for its
computation,so it is always faster than any server-side script like ASP,PHP,etc..