DEV Community

loading...

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

Collapse
waqarhusain profile image
Waqar Hussain • Edited

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.

developer.mozilla.org/en-US/docs/W...