What will be the output of the following JavaScript code? [code] <p id="demo"></p> <script> var arr = ["1", "1", "2", "1"]; var a = arr.lastInde

What will be the output of the following JavaScript code?
Code:
<p id="demo"></p>
<script>
var arr = ["1", "1", "2", "1"];
var a = arr.lastIndexOf("1");
document.getElementById("demo").innerHTML = (a + 1);
</script>
A. 2
B. 3
C. 4
D. 0
 

Tìm kiếm

Back
Top