Multiple choice technology enterprise content management

var test = "Hello World" what will test.substr(3,7) result in

  1. lo w

  2. lo worl

  3. lo wo

  4. index out of range error during compilation

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

The substr(start, length) method extracts characters starting at index start for a specified length. For "Hello World", starting at index 3 ('l') for 7 characters yields "lo Worl" (case-sensitive 'W'). The stored option has a lowercase 'w', but it is the intended answer.