Don't quite understand the last position in a substring

<PLEASE USE THIS TEMPLATE TO HELP YOU CREATE A GREAT POST!>

<Below this line, add a link to the EXACT exercise that you are stuck at.>

<Below this line, in what way does your code behave incorrectly? Include ALL error messages.>

```

console.log(“January”.substring(0,3));

If I want jan as the output, why is the second position in the substring 3? If I count from 0 the N in would be 2…

<do not remove the three backticks above>

jan has the following indexes: 0, 1 and 2. and substring works for values lesser then (<) the stop value (in your case 3)

1 Like

Sorry, still don’t understand. Why is the stop value 3?

because you want to get jan which are at the following indexes: 0, 1 and 2

so you need a stop value of 3, because the stop value is not included

1 Like

Oh, didn’t realize the stop value wasn’t included thanks!

that was also in my original answer, what do i need to improve upon on my first answer?

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.