A
Q. Find output of below Javascript addition code
Code:document.write("2 plus 2 is " + 2 + 2);
Here, you will find a collection of MCQ questions on JavaScript. Go through these questions to enhance your preparation for upcoming examinations and interviews.
To check the correct answer, simply click the View Answer button provided for each question.
Have your own questions to contribute? Click the button below to share your MCQs with others!
+ Add QuestionA
document.write("2 plus 2 is " + 2 + 2);
A
<script> document.write(2+2 + " = 2 plus 2"); </script>
A
<script> var question = "Your species?"; var defaultAns = "human"; var out = prompt(question, defaultAns); document.write(out); </script>
A
<script> var a = 10; if(a == 20); document.write(a); </script>
A
<script> var a = 10; if(a == a++) document.write(a); </script>
A
<script>
var a = 10;
if(a == a++);
{
document.write(a);
}
</script>
A
<script>
for(var i=0;i<5;i++)
{
document.write(i++);
}
</script>
A
<script>
for(var i=0;i<5;i++);
{
document.write(i++);
}
</script>
A
<script>
for(var i=0;i++<5; )
{
document.write(i);
}
A
<script>
var firstNames = ["c", "c++", "java", "python", "perl"];
for (var i = 0; i < firstNames.length; i++) {
if(i%2===0)
continue;
document.write(i);
}
</script>
If you want to share an MCQ question in this category, it's a great idea! It will be helpful for many other students using this website.
Share Your MCQ