Paul Irish

Making the www great

Concatenate()

Updated 2008.01.28: Great idea from Marc and Hendrik. Very slick.

1
2
3
4
5
6
7
8
function concatenate(){
  // return arguments.join('');                      // won't work. arguments is not a real array.
  // return [].splice.call(arguments,0).join('');    // old 'n busted
     return Array.prototype.join.call(arguments,''); // new hotness
}

concatenate('good',2,'go');
// ==> 'good2go'

Comments