JSP Interview Questions and answers

JAVA SCRIPT Interview Questions and answers
Can Javascript code be broken in different lines?
Yes,
Breaking is possible within a string statement by using a backslash "\" at the end .
Ex:
document.write("Good Morning. \
I am Mr. John");
But it is not possible within any other javascript statement.
Ex :
is possible but not
document.write \
("Good Morning. I am Mr. John");
What does break and continue statements do in JavaScript?
Continue statement continues the current loop (if label not specified) in a new iteration whereas break statement exits the current loop in JavaScript.
Explain about the Boolean functions present in Javascript?
Three Boolean operators are present in Javascript they are
1) &&
2) II
3) /
All the operators are regarded as true unless the Javascript regards them as false. You can define these operators to make as statement false number0, null, undefined, or a string of length 0, etc. Boolean function performs these conversions explicitly.
What is the difference between an alert box and a confirmation box?
An alert box displays only one button which is the OK button whereas the Confirm box displays two buttons namely OK and cancel.
How to validate a Email-address, in Form using JavaScript?
We can validate it through the reg expressions. For example we can declare all the reg expressions of the email in a variable as follows.
var reg = /^([A-Za-z0-9_-.])+@([A-Za-z0-9_-.])+.([A-Za-z]{2,4})$/; We need to compare the actual value with this expression for the validation.
How do you declare 2 dimensional array in Javascript?
myarray[0][0]="Compaq 486"
myarray[0][1]="Compaq 586"
myarray[0][2]="Compaq 686"
myarray[1][0]="Dell 486"
myarray[1][1]="Dell 586"
myarray[1][2]="Dell 686"
myarray[2][0]="IBM 486"
myarray[2][1]="IBM 586"
myarray[2][2]="IBM 686"
How do you Implement Timer Control in Javascript?
set Timedout("alert('5 seconds')",5000); Here the argument 5000 shows the millisecond value.
Whether VBscript or Javascript which is better?
Javascript. Since it is platform independent.
Whether Javascript is a OOP's based language?
No. It doesn't support all the concepts of OOPS. It supports partially.

No comments:

 
Top Blogs