TechieClues

Javascript - Interview Questions & Answers
1. What is JavaScript?
JavaScript is a client-side scripting language that can be inserted into HTML pages and is understood by web browsers.
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. What are JavaScript types?
Following are the JavaScript types:
  • Number
  • String
  • Boolean
  • Function
  • Object
  • Null
  • Undefine
4. 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.
         <script type="text/javascript">
                document.write("JavaScript Hello World!");  
         </script> 
5. How to use external JavaScript file?
I am assuming that js file name is "sample.js", place the following script tag inside the head tag.
         <script type="text/javascript" src="sample.js"></script>  
6. Is JavaScript case sensitive?
Yes.A function getElementById is not the same as getElementbyID.
7. What is the difference between Client side JavaScript and Server side JavaScript.
Client side java script comprises the basic language and predefined objects which are relevant to running java script in a browser. The client side java script is embedded directly by in the HTML pages. This script is interpreted by the browser at run time.
Server side java script also resembles like client side java script. It has relevant java script which is to run in a server. The server side java scripts are deployed only after compilation.
8. What is ‘this’ keyword in JavaScript?
‘This’ keyword is used to point at the current object in the code.
For instance: If the code is presently at an object created by the help of the ‘new’ keyword, then ‘this’ keyword will point to the object being created.
Questions & Answers
Scripting Languages