Java Script Interview Questions and Answers

What is JavaScript?
JavaScript is a scripting language, designed to add interactivity to HTML pages, JavaScript is usually embedded directly into HTML pages, and JavaScript is an interpreted language (means that scripts execute without preliminary compilation) JavaScript is a platform-independent, event-driven, interpreted client-side scripting and programming language developed by Netscape Communications Corp. and Sun Microsystems.
Define JavaScript Variables?

JavaScript is case-sensitive, variable names are case-sensitive. Creating variables in JavaScript is most often referred to as "declaring" variables. You declare JavaScript variables with the var keyword:
Var x;
Var fu='hi';
Var gf=3.45;

What is variable typing in java script?
It is perfectly legal to assign a number to a variable and then assign a string to the same variable as follows example i = 10; i = 'stringchar'; This is called variable typing
How do you create an object in JavaScript?
var person = new Object; or var person = {};
Are Java and JavaScript the same?
NO! Java and JavaScript are two completely different languages in both concept and design! Java (developed by Sun Microsystems) is a powerful and much more complex programming language - in the same category as C and C++. JavaScript’s syntax is loosely based on Java
What's relationship between JavaScript and ECMA Script?

ECMA Script is yet another name for JavaScript (other names include Live Script). The current JavaScript that you see supported in browsers is ECMA Script revision 3. Java Script is a scripting language that has been widely accepted for client side web development. However it originated from ECMA standards. ECMA and live scripts are just other names of java script.

What Boolean operators does JavaScript support?
&&, || ,!
What looping structures are there in JavaScript?
For, while, do-while loops
What is the difference between undefined value and null value?
Undefined means a variable has been declared but has not yet been assigned a value. On the other hand, null is an assignment value. It can be assigned to a variable as a representation of no value. Also, undefined and null are two distinct types: undefined is a type itself (undefined) while null is an object. Unassigned variables are initialized by JavaScript with a default value of undefined. JavaScript never sets a value to null. That must be done programmatically.

What data types are supported in Java Script?
Number, String, Undefined, null, Boolean
Explain a JavaScript Comments?

Comments can be added to explain the JavaScript, or to make the code more readable.
Single line comments start with //.
Multi line comments start with /* and end with */

What does the tag do?
Displayed the text enclosed within tag when JavaScript is disabled
What is === operator in JavaScript and how it is different from == operator?

=== operator checks for the equality. It gives true when both the compared values are having same value and same data type as === does not perform any type conversion while comparing. 

It is different from == as == does the type conversion while comparing.

What is the difference between JavaScript and Jscript?

Jscript supports more rich set of functionality/commands than the java script, through which ActiveX and local computer can be accessed. These commands are used in an intranet where the connecting computer's configuration is known and they are all being accessed using Internet Explorer. While java script targets unknown machine configuration and Jscript cannot for which java script are suitable for internet which Jscripts are not.

What is the main difference between Client side JavaScript and Server side Java Script? How actually they run on both side?

To state the main difference, JavaScript at the client side does not require a web server to make it run instead it uses the client's processor for this purpose. This eradicates the portability issue. But in server side JavaScript deployment, portability, configuration are major and vast issues and requires a web server to run the script within a page before rendering its output as a response html page.

How can JavaScript make a Web site easier to use?
JavaScript’s run on the client side which saves the server roundtrip time for small processing. It means that it makes web pages more interactive as everything is not required to be submitted at the server. Let’s consider a small clock if controlled by the server then the transmission time will make the clock faulty in this case java script is used.

Latest Updates

Direction

Swapnil start from his home and walked 35 km towards east, after that he turned to his right and walked 20 km. He again turned to his right and walks 35 km. Finally, he turned to his left and walked 20 km and reached his office. How far is his office from his home?

Numbers

How many 2 digit numbers are divisible by 6?

HCF and LCM

Find the smallest square number which is exactly divisible by 3, 5, 15, 18, 20 and 24?

HCF and LCM of two numbers are 82 and 574 respectively. if one of the numbers is 287, find the second number?

Numbers

How many numbers between 1200 to 1500 are multiple of 13?

Find the total number of terms in the series : -3, 1, 5, 9,............., 101 ?

Find the sum of the first 20 terms of the series : 8, -3, 11, -6, 14, -12, 17, -24,....... ?

Series

Find the missing term in the given series - 101, 120, 145, 168, (?), 224

Find the missing term in the given series - 11A13, 17E19, (?), 31O37, 41U43

Find the missing term in the given series - 2,4,8,3,9,27,4,16,(?),5,25,125

Agriculture

Which gas is fixed by Rhizobium bacteria present in the root nodules of a pea plant ?

Chemistry

The formation of sulphurous acid involves ?

The acid present in soft drinks is ?

The cathode of a dry cell is made of ?

The number of atoms present in the molecule of an element is known as its?

Physics

If the angle of incidence formed by a ray of light on a plane mirror is 37°, then the angle of refraction is?

A dynamo converts ?

If the time taken for hearing the echo of a girl's voice after reflection from a cliff is 6 seconds, calculate the distance of the girl from cliff ?