Như Quỳnh Lan
New member
What will be the output of the following JavaScript code?
A. d
B. a
C. b
D. c
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>
B. a
C. b
D. c