The difference is in the second argument. The second argument to substring is the index to stop at (but not include), but the second argument to substr is the maximum length to return.
Links?
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/substr
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/substring
Answer from Delan Azabani on Stack Overflowecmascript 6 - Diferencias entre substr(), substring() y slice() Javascript - Stack Overflow en español
What is Difference between SUBSTR(), MID(), SUBSTRING() in SQL?
When I can't remember the difference between slice, splice, substr and substring
If you could only use string.slice or string.substring, which string method would you choose?
Videos
The difference is in the second argument. The second argument to substring is the index to stop at (but not include), but the second argument to substr is the maximum length to return.
Links?
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/substr
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/substring
substr (MDN) takes parameters as (from, length).
substring (MDN) takes parameters as (from, to).
Update: MDN considers substr legacy.
alert("abc".substr(1,2)); // returns "bc"
alert("abc".substring(1,2)); // returns "b"
You can remember substring (with an i) takes indices, as does yet another string extraction method, slice (with an i).
When starting from 0 you can use either method. When starting negative, use slice (MDN).