Why does this work (returns \"one, two, three\"):
var words = [\'one\', \'two\', \'three\'];
$(\"#main\").append(\'\' + words.join(\", \") + \'
You could use this jQuery .joinObj Extension/Plugin I made.
As you'll see in that fiddle, you can use it as follows:
$.joinObj(args, ",");
or
$.(args).joinObj(",");
Plugin Code:
(function(c){c.joinObj||(c.extend({joinObj:function(a,d){var b="";if("string"===typeof d)for(x in a)switch(typeof a[x]){case "function":break;case "object":var e=c.joinObj(a[x],d);e!=__proto__&&(b+=""!=b?d+e:e);break;default:"selector"!=x&&"context"!=x&&"length"!=x&&"jquery"!=x&&(b+=""!=b?d+a[x]:a[x])}return b}}),c.fn.extend({joinObj:function(a){return"object"===typeof this&&"string"===typeof a?c.joinObj(this,a):c(this)}}))})(jQuery);