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

Latest Updates

General Knowledge of MP

Under the Madhya Pradesh Ladli Laxmi Yojana, the beneficiary is paid the total amount on attaining the age of ?

Indian Politics

Who appoints the Chairman and the Members of the Union Public Service Commission?

General Knowledge of World

Which country will host the 2022 Football World Cup?

Area

The angles of a triangle are in the ratio 2 : 4 : 3. The smallest angle of the triangle is?

Which one of the following triples does not represent the sides of a triangle?

If the perimeter of a rectangle is 10 cm and the area is 4 cm2, then its length is?

Height and Distance

An aeroplane flying at a height of 300 m above the ground passes vertically above another plane at an instant when the angles of elevation of the two planes from the same point on the ground are 60º and 45º respectively. What is the height of the lower plane from the ground?

From the top of a building 90 m high, the angles of depression of the top and the bottom of a tree are 30º and 45º respectively. What is the height of the tree?

Trigonometry

What is the value of sinx √( 1 /1+cosx + 1 /1-cosx ) ?

What is cos4 A - sin4 A / cos2 A - sin2 A equal to?

If 7sin2 x +3cos2 x = 4, 0 < x < 90º ,then what is the value of tan x?

If x = a cosθ + b sinθ and y = a sinθ - b cosθ then what is x2 + y2 equal to?

Average

The mean of 5 numbers is 15. If one more number is included, the mean of the 6 numbers becomes 17. What is the included number?

The mean marks obtained by 300 students in a subject are 60. The mean of top 100 students was found to be 80 and the mean of last 100 students was found to be 50. The mean marks of the remaining 100 students are?

In an asymmetrical distribution, of the mean and median of the distribution are 270 and 220 respectively, then the mode of the data is?

Let a, b, c, d, e, f, g be consecutive even numbers and j, k, l, m, n be consecutive odd numbers. What is the average of all the numbers?

Alligation or Mixture

25 kg of alloy X is mixed with 125 kg of alloy Y. If the amount of lead and tin in the alloy X is the ratio 1 : 2 and the amount of lead and tin in the alloy Y is in the ratio 2 : 3, then what is the ratio of lead to tin in the mixture?

Simplification

The ratio of two numbers is 1 : 5 and their product is 320. What is the difference between the square of these two numbers?