Fixed, thanks.

Dave, digging his way out of a massive backlog...

On Sep 23, 2011, at 12:18 PM, Axel Rauschmayer wrote:

> http://wiki.ecmascript.org/doku.php?id=harmony:string_extras
> I’ve found a small bug:
> 
> String.prototype.endsWith = function(s) {
>     var t = String(s);
>     return this.lastIndexOf(t) === this.length - t.length;
> };
> Interaction:
> > "".endsWith("/")
> true
> > "#".endsWith("//")
> true
> > "##".endsWith("///")
> true
> 
> Fix (e.g.):
> String.prototype.endsWith = function(s) {
>     var t = String(s);
>     var index = this.lastIndexOf(t)
>     return index >= 0 && index === this.length - t.length;
> };
> 
> 
> -- 
> Dr. Axel Rauschmayer
> 
> a...@rauschma.de
> twitter.com/rauschma
> 
> home: rauschma.de
> blog: 2ality.com
> 
> 
> 
> _______________________________________________
> es-discuss mailing list
> es-discuss@mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss

_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to