Interview Questions JavaScript

JavaScript


1. What is the use of Math Object in JavaScript?
The math object provides you properties and methods for mathematical constants and functions.

2. How do you change the style/class on any element using JavaScript??
document.getElementById("myText").style.fontSize = "10";

3. In JavaScript, Window.prompt() method return true or false value ?
0

4. Math. round(-20.51)=?
-21

5. <script language="javascript">
function x()
{
var s = "Quality 100%!{[!!";
var pattern = /\w/g;
var output = s.match(pattern);
document.write(output);
}
</script>
Q,u,a,l,i,t,y,1,0,0

6. <script type="text/javascript" language="javascript">
var qpt= new Array();
qpt[0] = "WebDevelopment";
qpt[1]="ApplicationDevelopment"
qpt[2]="Testing"
qpt[3] = "QualityPointTechnologies";
document.write(qpt[0,1,2,3]);
</script>
QualityPointTechnologies

7. the server-side JavaScript object?
File

8. <script language="javascript">
function x()
{
document.write(2+5+"8");
}
</script>
78

9. _________ keyword is used to declare variables in javascript.
Var

10. Which of the following method is used to evaluate the regular expression?
eval(2*(3+5))