Consistency in The Negative Result Values Through Expansion of null's Role

Erik Reppen erik.reppen at gmail.com
Fri Aug 17 08:51:05 PDT 2012


Sorry: mailing-list noob and I forget to CC es-discuss.

Nothing wrong with join(''). If anything I'm a bit overly fond of
split/join approaches to problems. My only point was that I could do
something awful to the join method (like changing it to alert that stupid
message regardless of args) only in the context of that function and then
swap the original method back in before it interfered with other people's
code.

On Fri, Aug 17, 2012 at 10:38 AM, Brendan Eich <brendan at mozilla.org> wrote:

> Erik Reppen wrote:
>
>> myPocketD( function(){ //altered proto methods swapped before this func
>> arg is fired and then swapped back after it closes
>>     [0,1].join(''); //alerts 'Somebody did something awful to the Array
>> join method!'
>>     //you could pretty much write your entire app in spaces like this and
>> then plug in third party stuff without fear of blowing anything up.
>> });
>>
>
> Is join('') awful? It has its uses, along with an identity when you know a
> string has no non-BMP chars encoded as pairs):
>
>   s.split('').join('') === s
>
> Now and then, split('') followed by array processing followed by join('')
> works best.
>
> Also, building an array and then doing a.join('') to get a string used to
> be a perf win over +-based string concatenation in IE, at least.
>
> /be
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20120817/2bddfc52/attachment.html>


More information about the es-discuss mailing list