I will get the data from the server as NY^NJ^CA^MI or NC^SC etc and need to replace “^” with “,” (coma) . I have tried following two approaches but not working.
Can anyone guide me what went wrong with these approaches?
Ex: var str=“NY^NJ^CA^MI”;
var test = str.replace(/^/g, “,”);
or
var test = str.replace(/^/g, ‘,’);
Thanks in advance