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>
  1. he
  2. undefinedh
  3. ValueError
  4. TypeError

Answer: A) he

Explanation:

In JavaScript, the array indexing starts with 0. Thus, the above statement with print "h" and "e".

Comments and Discussions!

Load comments ↻






Copyright © 2024 www.includehelp.com. All rights reserved.