Java Script Interview Questions and Answers Part 1


1. Which company developed JavaScript?

Ans. Netscape is the software company who developed JavaScript.

2. What is JavaScript?

Ans. JavaScript is a client-side scripting language that can be inserted into HTML pages and is understood by web browsers.

3. Enumerate the differences between Java and JavaScript?

Ans. Java is a complete programming language. In contrast, JavaScript is a coded program that can be introduced to HTML pages. These two languages are not at all inter-dependent and are designed for the different intent. Java is an object - oriented programming (OOPS) or structured programming language like C++ or C whereas JavaScript is a client-side scripting language and it is said to be unstructured programming.

4. What are JavaScript types available?

Ans. Following are the JavaScript types:








5. Explain about isNaN() function?

Ans. isNaN() function returns true if the argument is not a number otherwise it is false.

6. Difference between JavaScript and an ASP script, which is faster?

Ans. JavaScript is faster. JavaScript is a client-side language and thus it does not need the assistance of the web server to execute. On the other hand, ASP is a server-side language and hence is always slower than JavaScript.

7. Explain negative infinity?

Ans. Negative Infinity is a number in JavaScript which can be derived by dividing negative number by zero.

8. What are global variables? How are these variable declared and what are the problems associated with using them in java script?

Ans. Global variables are those that are available throughout the length of the code, that is, these have no scope. The “var” keyword is used to declare a local variable or object. If the “var” keyword is omitted, a global variable is declared.


// Declare a global global_variable = "Hello";

The problems that are faced by using global variables are the clash of variable names of local and global scope. Also, it is difficult to debug and test the code that relies on global variables.

9. What are undeclared and undefined variables?

Ans. Undeclared variables are those that do not exist in a program and are not declared. If the program tries to read the value of an undeclared variable, then a runtime error is encountered.

Undefined variables are those that are declared in the program but have not been given any value. If the program tries to read the value of an undefined variable, an undefined value is returned.

10. Is it possible to break JavaScript Code into several lines?

Ans. Yes, breaking within a string statement can be done by the use of a backslash, ‘\’, at the end of the first line.


Receive Quality Tutorials Straight in your Inbox by submitting your Email below:

Delivered by FeedBurner

Protected by Copyscape Duplicate Content Checker