html5 - How to replace character from array items using javascript? -


i have got array items dynamically ["{text: "us"}", "{text: "mexico"}", "{text: "brazil"}"]. need replace char "{ char { , char }" char }. after replacing need output [{text: "us"}, {text: "mexico"}, {text: "brazil"}]. if single object means can replace. array list not getting. have tried below, 1 not working how can achieve one? great appreciated. thank you.

dynamicsubregions =["{text: "us"}", "{text: "mexico"}", "{text: "brazil"}"]; var dynamicsubregionsfinal = dynamicsubregions[dynamicsubregions.indexof('"{')] = '{'; 

your array syntax wrong , double quotes arn't inside variable

dynamicsubregions =["{text: \"us\"}", "{text: \"mexico\"}", "{text: \"brazil\"}"]; alert(dynamicsubregions[0]); 

http://jsfiddle.net/dftgy/


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -