Search Results

Search found 1 results on 1 pages for 'estrar'.

Page 1/1 | 1 

  • Javascript array - merge two arrays into one

    - by estrar
    I have two arrays, one with name of the country and one with the currency type. I would like to merge these together and use the country key instead of the currencies array. What would be the best way to accomplish this? This is what my code looks like now: var country = new Array(); country["SEK"] = 'Sweden'; country["USD"] = 'United states'; var currencies = ["SEK","USD"]; var options = ''; for (var i = 0; i < currencies.length; i++) { options += '<option value="' + currencies[i] + '" id="' + currencies[i] + '">' + currencies[i] + ' (' + country[currencies[i]] + ')</option>'; }

    Read the article

1