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

Physics

Atmospheric pressure at sea level equals ?

General Knowledge of India

Which of the following dance forms was introduced by the great Vaishnava saint and reformer Mahapurusha Sankaradeva ?

Which of the following is the only classical dance of india having links with Muslim culture and represents a unique synthesis of Hindu and Muslim genius in art ?

Time and Distance

Starting from the same point at the same time, Ruhan and Yuvan had to reach the same destination. While Ruhan drove at 45 km/hr, Yuvan was slower by 5 km/hr. If Yuvan arrived at the destination an hour after Ruhan did, the distance covered by each, in Kilometres, was ?

Simple Interest

A sum of money was invested at a certain rate of simple interest for 4 years. Had the sum been invested at a rate 3% higher than the actual rate, the interest earned would have been 720 Rs more. Find the sum initially invested?

Ratio and Proportion

A bag contains red, blue and black balls. The ratio of red to blue balls is 3 : 5. The ratio of black to red balls is 3 : 4. What is the ratio of blue to black balls?

Profit and Loss

Selling a pack of incense sticks for 136 Rs resulted in a loss of 15%. To make a profit of 10%, the selling price should be ?

Percentage

23% of a bucket full of diluted milk was water. If the quantity of pure milk in the bucket was 15.4 liter, then the capacity of the bucket was ?

Average

The average of the marks obtained by three girls in a test was twice the average of the marks obtained by eight boys in that test. If the total marks obtained by all these examinees was 168, find the average marks each of the girls obtained ?

Pipes and Cistern

44 pipes can fill a large water tank in 27 hours. How many hours it take for 66 pipes to fill four such tanks ?

HCF and LCM

A natural number, when divided by 3, 4, 5, 6, and 7 respectively, leaves corresponding remainder of 2, 3, 4, 5 and 6. What is the smallest of all such numbers fulfilling the above condition ?

Coding-Decoding

If in a certain code language, PRINT is written as 34825 and TRUE is written as 5479. Then, how will TENURE be written in that language?

Order Sequence

Arrange the given words from smallest to biggest-
1.Jug
2.Mug
3.Bucket
4.Drum
5.Cup

Statement and Conclusion

Statements
All socks are shoes
Some shoes are black

Conclusions
I. Some shoes are socks.
II. No scoks is black

Numbers

The difference between the place value of 4 and 2 in the number 833749502 is ?

Analogy

GIKM : HJLN :: PRTV : .........?

Order Sequence

In a row of girls, Nanda is eighth from the left and Chanda is nineteenth from right. When Nanda and Chanda interchange their positions, Chanda becomes twnty-third form right. How many girls are there in the row?

Analogy

Summer: Day :: Winter : ........?