I want to convert the space in a string into another character.
Ex:
var country = "United States"
I want the space to be "-" so:
var country = "Unites-States"
This is what I tried:
var country ="United States";
var countryArray = country.split(" ");
var newCountry = function(){
for(i=0;i<countryArray.length;i++){
if(countryArray[i]===","){
return countryArray[i]="-";}
}
country = country.replace(" ","-")