Q. Which one of the following options is the correct output for the given code of JavaScript?
Code:functionfun()
{
var a=1;
var b=2;
return a*b;
}
document.write(fun());
Dear candidates you will find MCQ questions of JavaScript here. Learn these questions and prepare yourself for coming examinations and interviews. You can check the right answer of any question by clicking on any option or by clicking view answer button.
Share your questions by clicking Add Question
functionfun()
{
var a=1;
var b=2;
return a*b;
}
document.write(fun());
var arr=[1, 3, 5, 8 ,11]; var value =Math.max.apply(null,arr); document.writeln(value);
var person =
{
name: "James",
getName:function()
{
nreturnthis.name;
}
}
varunboundName=person.getName;
varboundName=unboundName.bind(person);
document.writeln(boundName());
function code(id,name)
{
this.id= id;
this.name= name;
}
functionpcode(id,name)
{
code.call(this,id,name);
}
document.writeln(newpcode(004,"James Deo").id);
var pow=newFunction("num1","num2","return Math.pow(num1,num2)");
document.writeln(pow(2,3));
functionconstfun()
{
var fun =[];
for(vari=0;i<10;i++)
fun[i]=function(){returni;};
return fun;
}
var fun =constfun();
fun[5]()
<p id="demo"></p>
<script>
functionFunct()
{
document.getElementById("demo").innerHTML=Math.atan2(8,4);
}
</script>