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 <[email protected]> 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
>
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to