javascript - How to strip string from a string and push into array? -


i running following:

var countries = []; $("#usp-custom-3 option").each(function() {   var single = $(this).text();   if($(single == "united states of america")) {     $(this).text() == "united states";   }   countries.push(single);   console.log(single); }); 

basically trying convert united states of america united states before push array rest of countries have list of countries in select option.

var countries = [];    $("#usp-custom-3 option").each(function() {     var single = $(this).text();     if(single == "united states of america") {      single= "united states";     }     countries.push(single);     console.log(single);   }); 

Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -