dates.map(date => `'${date}'`).join(',');
var array1 = ["test, test1"];
var array = array1[0].split(',');
array = array.map(i => '"' + i + '"');
alert(array)
Run code snippet
var dates = ['1/2/12','15/5/12'];
console.log("'" + dates.join("','") + "'");