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

Brendan Eich brendan at
Fri Aug 17 08:38:53 PDT 2012

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.


More information about the es-discuss mailing list