I have a string like this:
var string = ' [United States] [Canada] [India] ';
I want to do a for loop and add each of the countries into an array in Javascript or Jquery, something like this:
var countryArray = new Array();
for ( each country in string AS country) {
countryArray.push(country);
}
I'm not sure how I would make a foreach loop out of a string like that.
"[U] [C] [I]".split(' ');?