What will be the output of the following JavaScript code? [code] function myFunction() { var x = ""; document.getElementById("demo").innerH

Trang Esther

New member
What will be the output of the following JavaScript code?
Code:
function myFunction() 
{
  var x = "";
  document.getElementById("demo").innerHTML = Boolean(x);
}
A. true
B. false
C. 0
D. 1
 
Answer: b
Explanation: When an empty string is passed to the boolean function then the function returns false. The boolean function returns true or false according to the input passed to it.
 

Tìm kiếm

Back
Top