Why does this work (returns \"one, two, three\"):
var words = [\'one\', \'two\', \'three\'];
$(\"#main\").append(\'\' + words.join(\", \") + \'
You can use typeof to see what's happening here:
>>> typeof(['one', 'two', 'three'])
"object"
>>> typeof(['one', 'two', 'three'].join)
"function"
>>> typeof(arguments)
"object"
>>> typeof(arguments.join)
"undefined"
Here you can see that typeof returns "object" in both cases but only one of the objects has a join function defined.