Javascript language

adplus-dvertising
Javascript FAQ
previous Home Next

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

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 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 value called undefined value.

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 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 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.

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’s relationship between JavaScript and ECMAScript?

ECMAScript is yet another name for JavaScript (other names include LiveScript). The current JavaScript that you see supported in browsers is ECMAScript revision 3.

What are JavaScript types?

Number, String, Boolean, Function, Object, Null, Undefined.

How do you convert numbers between different bases in JavaScript?

Use the parseInt() function, that takes a string as the first parameter, and the base as a second parameter. So to convert hexadecimal 3F to decimal, use parseInt ("3F", 16); What does isNaN function do? - Return true if the argument is not a number.

previous Home Next