Home »
MCQs »
JavaScript MCQs
What is the output of the following JavaScript code? | Question 11
60. What will be the output of the following JavaScript code?
<script>
const myArray = ['h', 'e', 'l', 'l', 'o'];
document.write(myArray[0]);
document.write(myArray[1]);
</script>
- he
- undefinedh
- ValueError
- TypeError
Answer: A) he
Explanation:
In JavaScript, the array indexing starts with 0. Thus, the above statement with print "h" and "e".