What is the output of `’hello'[1]`?

JavaScript Professional Easy

JavaScript Professional — Easy

What is the output of `’hello'[1]`?

Key points

  • Indexing in JavaScript starts at 0, so the first character is at index 0.
  • 'e' is the second character in the string 'hello'.
  • Accessing an index beyond the length of the string would result in undefined.
  • The correct syntax for accessing characters in a string is using square brackets [].

Ready to go further?

Related questions