DEV Community

Discussion on: Two string methods every JavaScript developer should know.

waqarhusain profile image
Waqar Hussain • Edited on

Substr should not be used. Instead use substring

String.prototype.substr(…) is not strictly deprecated (as in "removed from the Web standards"), it is considered a legacy function and should be avoided when possible. It is not part of the core JavaScript language and may be removed in the future. If at all possible, use the substring() method instead.