What is the best way to split a string into array objects? I would like the following string:
var str = "New York, California, Indiana"
to turn into the following array
var arr = ["New York", "California", "Indiana"]
Please note: the string includes spaces and commas that I would like to disregard, but some spaces need to be retained (i.e. space between "New York"). What would be the best way to accomplish this?
str.split(', ')