Why does this work (returns \"one, two, three\"):
var words = [\'one\', \'two\', \'three\']; $(\"#main\").append(\'\' + words.join(\", \") + \'
\' + words.join(\", \") + \'
I don't know if there's a simple way to convert arguments into an array, but you can try this:
var toreturn = "the list:"; for(i = 0; i < arguments.length; i++) { if(i != 0) { toreturn += ", "; } toreturn += arguments[i]; }