I have below string -
var a = \"1,2,3,4\";
when I do -
var b = a.split(\',\');
I get b as
b
As a variant you can use combiantion _.map and _.ary methods from the lodash library. Whole transformation will be a more compact. Here is example from the official documentation:
_.map
_.ary
_.map(['6', '8', '10'], _.ary(parseInt, 1)); // → [6, 8, 10]