Q. Which one of the following is correct output for the following given JavaScript code:
Code:<p id="demo"></p>
<script>
functionourFunction()
{
document.getElementById("demo").innerHTML=Math.abs(-7.25);
}
</script>
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
<p id="demo"></p>
<script>
functionourFunction()
{
document.getElementById("demo").innerHTML=Math.abs(-7.25);
}
</script>
<p id="demo"></p>
<script>
function Function1()
{
document.getElementById("demo").innerHTML=Math.cbrt(792);
}
</script>
<p id="demo"></p>
<script>
functionmyFunction()
{
document.getElementById("demo").innerHTML=Math.acos(0.5);
}
</script>
Let's solve it carefully:
In JavaScript, if the value is null, and you apply the typeof unary operator, for example:
typeof null
Then the result is: "object".
Reason:
Therefore, the correct answer is:
(D) object
var a =[]; a.unshift(5); a.unshift(22); a.shift(); a.unshift(3,[4,5]); a.shift(); a.shift(); a.shift();
var sum=0;
vararr=[101,150,201,30];
arr.forEach(functionmyFunction(element)
{
sumsum=sum+element;
});
document.writeln(sum);
var values=["Three","two","one"]; varans=values.shift(); document.writeln(ans);