MCQ
Single Best Answer
Easy
QWhat would the following JavaScript code produce?
ID: #5024
Javascript Modules MCQ
166 views
Question Info
#5024Q ID
EasyDifficulty
Javascript Modules MCQTopic
Your Answer
Choose the Best Option
Click any option to instantly check if you're correct.
Correct Answer: Option B
Explanation
This script defines a function called myFunction() that does the following:
Declares a variable res and initializes it to an empty string.
Concatenates the result of the Number.isFinite() function applied to the expression 5-2 to res.
The Number.isFinite() function returns a boolean value indicating whether the value passed to it is a finite number.
In this case, it would return true.
Selects the element with the ID "demo" and changes its inner HTML to the value of res.
When the function is called, the element with the ID "demo" would display the text "true".
Continue Practice
Share
Share This Question
Challenge a friend or share with your study group.
More from This Topic