QWhat would the following JavaScript code produce?
Question Info
Choose the Best Option
Click any option to instantly check if you're correct.
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.isInteger() function applied to the string '123' to res.
The Number.isInteger() function returns a boolean value indicating whether the value passed to it is an integer.
In this case, it would return false because the value passed is a string, not a number.
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 "false".
Share This Question
Challenge a friend or share with your study group.