Javascript Interview Question Answers






What is JavaScript?

Answer :
JavaScript is a client-side as well as server side scripting language that can be inserted into HTML pages and is understood by web browsers. JavaScript is also an Object Oriented Programming language

Enumerate the differences between Java and JavaScript?

Answer :
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. Both JavaScript and Jscript are almost similar. JavaScript was developed by Netscape. Microsoft reverse engineered Javascript and called it JScript.

What are JavaScript types?

Answer :
Following are the JavaScript types:Number, String, Boolean, Function, Object ,Null, Undefined

What is the use of isNaN function?

Answer :
isNan function returns true if the argument is not a number otherwise it is false

Between JavaScript and an ASP script, which is faster?

Answer :
JavaScript is faster. JavaScript is a client-side language and thus it does not need theassistance of the web server to execute. On the other hand, ASP is a server-side language and hence is always slower than JavaScript. Javascript now is also a server side language (nodejs).

What is negative infinity?

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

Is it possible to break JavaScript Code into several lines? Breaking within a string statement can be done by the use of a backslash, ‘’, at the end of the first line

Answer :
Example: Document.write(“This is a program”); And if you change to a new line when not within a string statement, then javaScript ignores break in line. Example: var x=1, y=2, z= x+y;

Which company developed JavaScript?

Answer :
Netscape is the software company who developed JavaScript

What are undeclared and undefined variables?

Answer :
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

What are global variables? How are these variable declared and what are the problems associated with using them?

Answer :
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. | newline | Example: | newline | // Declare a global globalVariable = "Test"; | newline | 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.










Best Interview Question Quiz Online Questions Answers