Your example and the way to get individual characters in your results show that your values ββare actually strings, for example:
var id_list = []; id_list[0] = '200, 201, 202, 203'; id_list[1] = '300, 301, 302, 303';
If this is the case, your first step should be converted to real arrays. You can do this simply by dividing by,, but a regular expression that removes spaces will also give you a cleaner result. / *, */ will look for a comma with optional spaces before or after it:
id_list[0] = id_list[0].split(/ *, */); // now id_list[0] is an array of 4 items: ['200', '201', '202', '203'] id_list[1] = id_list[1].split(/ *, */); // now id_list[1] is an array of 4 items: ['300', '301', '302', '303']
Then you can use concat() to combine arrays into one array:
var arr = id_list[0].concat(id_list[1]);
I suspect this is more like the result you expect:
console.log(arr[0]); // shows 200 console.log(arr[1]); // shows 201 console.log(arr[3]); // shows 203 console.log(arr[5]); // shows 301
source share