Skip to content

Commit

Permalink
Use charCodeAt instead of charAt
Browse files Browse the repository at this point in the history
`charCodeAt` is faster in general.

Ref. #4.
  • Loading branch information
mathiasbynens committed Dec 19, 2013
1 parent dd38046 commit bb1901f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion endswith.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ if (!String.prototype.endsWith) {
}
var index = -1;
while (++index < searchLength) {
if (string.charAt(start + index) != searchString.charAt(index)) {
if (string.charCodeAt(start + index) != searchString.charCodeAt(index)) {
return false;
}
}
Expand Down

0 comments on commit bb1901f

Please sign in to comment.