String Methods

AP Computer Science A· difficulty 3/5

<code>"hello".indexOf('l')</code> returns

  • A

    3

  • B

    2

    check_circle
  • C

    1

  • D

    −1

Explanation

Index of FIRST 'l' (at position 2). Returns -1 if not found.

Want 10 more like this — adaptive to your weak spots?

Related questions