What is the difference between substr() and substring() in JavaScript?
Answers
Answered by
0
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. Moreover, substr() accepts a negative starting position as an offset from the end of the string. substring() does not.
Similar questions
Math,
5 months ago
Physics,
10 months ago
Social Sciences,
11 months ago
India Languages,
11 months ago
Science,
11 months ago