-
Notifications
You must be signed in to change notification settings - Fork 475
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Get rid of String#substr #1
Comments
I've never met a browser not understanding String.substr() properly. I've been using this method for 5+ years without any problems what so ever?! |
There may not be problems with it in current browsers, but if there’s a standard, fully specced method (and there are several options here) why not use that one? Edit: Just to be clear: this was just a friendly heads up, I don’t mean to start a flamewar here. |
No no no flamewar going on here! I'm just surprised by your intel. |
https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/String/substr says substr() has been around since Javascript 1.0, although no ECMA specification. I wonder if this really is an issue :/ |
It’s not — it’s just good practice to use standardized methods where possible. |
I don't disagree. I find it interesting, though, that both standardized methods slice() and substring() take an index as the end-point, rather then number of characters to read (like substr() in any other language I know does…). weird. |
Fixed in v1.1.0 |
You may want to consider using
String#substring
orString#slice
instead of the non-standardString#substr
.The text was updated successfully, but these errors were encountered: