Browsing index pages (3 articles)
↧
how to convert string into javascript array
I have this string [['Kaufen Kaufen', 11.6024872, 50.96389749999999, 1], ['Demandware', -71.13296849999999, 42.4884618, 2],['Downtown TV Shop', -71.0661193, 42.3548561, 3], ['Electronics Super Store',...
View ArticleAnswer by Rajesh for how to convert string into javascript array
You can use JSON.parse to convert JSON to JS Objects/Arrays. Now issue is, your string has single quotes' and JSON.parse expects double quotes, so you will have to replace it.Another case can be, you...
View ArticleAnswer by jhhayashi for how to convert string into javascript array
function stringToArray(str) { return JSON.parse(str.replace(/'/g, '"'))}
View Article
Browsing index pages (3 articles)