The .split()
function returns an array; there's no need to build one. Your code builds a new array that will have one entry, the array returned by .split()
.
An easier way to build an array is to use an array literal:
return [1, 2, 3];
Whatever you pass in to the alert()
function will be coerced to a string, so it's not the best way to analyze behavior.