When splitting a string at runtime instead of using an array literal, you trade a small amount of runtime for a small amount of bandwidth.
In most cases, I would say that it is not worth it. If you used up and downloaded your code before publishing it, as it should be , using a single comma inside a line compared to a quote-comma- a quote from two lines in an array is unlikely to affect bandwidth savings. In fact, after minimizing and gzipping, the split-string version may be longer due to the addition of less compressible .split(',') .
Splitting a string instead of creating an array of string literals means a bit less text input, but we spend more time reading code than writing it . Using an array literal will be more convenient in the future. If you want to add a comma to an array element, you simply add it as another string to the array literal; using split , you will have to rewrite the entire line using another separator.
The only situation when I use split and a string literal to create an array is if I need an array consisting of only single characters, i.e. an alphabet, numbers or alphanumeric characters, etc.
var letters = 'abcdefghijklmnopqrstuvwxyz'.split(''), numbers = '0123456789'.split(''), alphanumeric = letters.concat(numbers);
You will notice that I used concat to create alphanumeric . If I instead copied the contents of letters and numbers into one long line, this code would compress better. The reason why I did not do this is because it will be micro-optimization, which will damage future maintainability. If in the future characters with accents, tildes or umlauts are to be added to the list of letters, they can be added in one place; no need to remember to copy them to alphanumeric too.
Splitting a string can be useful for golf code , but in a production environment where minimization and gzipping are factors and writing easy to read, maintainable code is important, just using an array literal is almost always the best choice.