Multiple choice technology web technology

To what value will the following expressions evaluate in the JavaScript console? "abc"[2]

  1. b

  2. a

  3. c

  4. None of the above

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

The correct answer is C (c) because JavaScript uses zero-based indexing for string access. The expression "abc"[2] accesses the character at index 2, which is 'c' (index 0='a', index 1='b', index 2='c'). Option A is incorrect because 'b' is at index 1. Option B is incorrect because 'a' is at index 0.