Substrings: Why ...(3,7), instead of (3,6)?


#1

So, if we are using zero-indexing, then if we want to get a substring beginning with the 4th letter through and including the 7th letter (in "wonderful day"), why isn't it "wonderful day".substring(3,6)??

That makes more sense since the 3rd position represents the 4th letter, so the 6th position - I would have 'thunk' - would represent the 7th. It seems inconsistent to me.


#2

Maybe the defintion
= https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/substring
will bring some comfort.