What will be the output of the following JavaScript code? [code] <button onclick="myFunction()">Try it</button> <p id="demo"></p> <script> funct

What will be the output of the following JavaScript code?
Code:
<button onclick="myFunction()">Try it</button>
<p id="demo"></p>
<script>
function myFunction() 
{
   var str = "a,b,c,d,e,f";
   var arr = str.split(",");
   document.getElementById("demo").innerHTML = arr[3];
}
</script>
A. d
B. a
C. b
D. c
 

Tìm kiếm

Back
Top