var colors= ['#FFF00','#FF000'], newColors = '[' + colors.toString().replace(/'|"/, '') + ']'; alert(newColors);