RSS Feed for Javascript Interview QuestionsCategory: Javascript Interview Questions

How to create a function using function constructor? »

The following example illustrates this
It creates a function called square with argument x and returns x multiplied by itself.
var square = new Function (”x”,”return x*x”);

What does break and continue statements do? »

Continue statement continues the current loop (if label not specified) in a new iteration whereas break statement exits the current loop.

What does the delete operator do? »

The delete operator is used to delete all the variables and objects used in the program ,but it does not delete variables declared with var keyword.

What is === operator? »

==== is strict equality operator ,it returns true only when the two operands are having the same value without any type conversion.

What are undefined and undeclared variables? »

Undeclared variables are those that are not declared in the program (do not exist at all),trying to read their values gives runtime error.But if undeclared variables are assigned then implicit declaration is done .
Undefined variables are those that are not assigned any value but are declared in the program.Trying to read such variables gives special [...]

Does javascript have the concept level scope? »

No.Javascript does not have block level scope,all the variables declared inside a function possess the same level of scope unlike c,c++,java.

What is variable typing in javascript? »

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 = “string”;
This is called variable typing

What is the difference between undefined value and null value? »

(i)Undefined value cannot be explicitly stated that is there is no keyword called undefined whereas null value has keyword called null
(ii)typeof undefined variable or property returns undefined whereas typeof null value returns object