Using Sets in JavaScript

Sets will added to the JavaScript standard during 2015, but a useful web page notes that it is possible to use them already in Chrome if you type or copy the address chrome://flags/ into your Chrome browser then enable "Experimental JavaScript Features". The initialisation and add() method will ensure that the set has no duplicate values. Here we use it to combine lists to get unique values of names of towns and cities. We provide first a little example to show how easy it is to get started with sets, then show a real-world example with more than 2000 members of a set. (In Pascal, sets are limited in size but have great functionality).

<!DOCTYPE html>
<html>
  <body>
    <script>
      var locationsArray1 = ['Cardiff', 'London', 'West Lafayette', 'Belfast', 'Watford', 'Wilmslow', 'Winchester', 'Winchester'];
      var locationsArray2 = ['Cardiff', 'London', 'West Lafayette', 'Belfast', 'Watford', 'Wilmslow', 'Knutsford'];
      var locationsSet = new Set(locationsArray1);
      console.log('Size of locationsArray1: ' + locationsArray1.length);
      console.log('Initial size of locationsSet: ' + locationsSet.size);
      for (var i = 0; i < locationsArray2.length; i++) 
        locationsSet.add(locationsArray2[i]);
      if (locationsSet.has('Knutsford')) 
        console.log('Knutsford is in locationsSet.');
       locationsSet.delete('Cardiff');
      if (locationsSet.has('Cardiff')) 
        console.log('Cardiff is still in locationsSet.')
      else    
        console.log('Cardiff has been removed from locationsSet.');
    </script> 
  </body>
</html>

Output copied from Chrome console:

SetsSimpleDemo.html:8 Size of locationsArray1: 8
SetsSimpleDemo.html:9 Initial size of locationsSet: 7
SetsSimpleDemo.html:13 Knutsford is in locationsSet.
SetsSimpleDemo.html:18 Cardiff has been removed from locationsSet.

Real-World Example

<!DOCTYPE html>
<html>
  <body>
    <script>
       var locationsArray1 = ["A Coruna","Aachen","Aalborg",
          "Aarhus","Aars","Aberdeen","Abha","Abidjan","Abingdon",
          "Abu Dhabi","Accra","Acworth","Adeje","Adelaide","Afyonkarahisar",
          "Aguascalientes","Ahmedabad","Ahrensburg","Ahvaz","Aix-en-Provence",
          "Ajalvir","Aksaray","Al Ain","Alajuela","Alanya","Alba Iulia",
          "Albacete","Albany","Albufeira","Albuquerque","Aldenhoven",
          "Alexandria","Algemesi","Algiers","Alicante","Alkmaar",
          "Allahabad","Almada","Almaty","Almelo","Almere","Almeria",
          "Almetyevsk","Alton","Americana","Amersfoort","Amiens",
          "Amsterdam","Anantapur","Andenne","Andernach","Andorra la Vella",
          "Angeles","Ankara","Annaba","Annandale-on-Hudson","Ansonia",
          "Antipolo","Antwerp","Anyang-si","Apeldoorn","Aracaju",
          "Ardea","Argenteuil","Arica","Arlington","Armavir",
          "Armenia","Arnhem","Arrasate","Artemivs'k","Arvada",
          "Aschaffenburg","Ashburn","Ashland","Asker","Assen",
          "Asten","Asti","Asuncion","Atascocita","Athens","Atlanta",
          "Auckland","Augsburg","Aurangabad","Aurora","Austin",
          "Aveiro Municipality","Bacau","Bacoor City","Bad Kreuznach",
          "Bad Langensalza","Bad Mergentheim","Bad Salzungen",
          "Bad Vilbel","Bad Zwischenahn","Badalona","Baden bei Wien",
          "Baghdad","Bahawalpur","Bahia Blanca","Baia Mare","Bainbridge Island",
          "Baku","Balatonfured","Balikesir","Ballerup","Ballwin",
          "Balneario Camboriu","Banbridge","Bandar Abbas","Bandar Lampung",
          "Bandar Seri Begawan","Bandung","Bangalore","Bangkok",
          "Banja Luka","Banjarmasin","Banska Bystrica","Barcelona",
          "Barcelona","Bardstown","Bargteheide","Bari","Barnaul",
          "Barnstable","Barquisimeto","Barra Velha","Barrie",
          "Barueri","Barzano","Basingstoke","Batam","Bataysk",
          "Bath","Baton Rouge","Bauru","Bautzen","Bay Shore",
          "Bayan Lepas","Bayonet Point","Bayreuth","Beijing",
          "Beirut","Beja","Bejaia","Bekescsaba","Belem","Belfast",
          "Belgaum","Belgorod","Belgrade","Bellaire","Bellingham",
          "Bellingwolde","Belo Horizonte","Belper","Belvidere",
          "Benoni","Bensenville","Bensheim","Bentonville","Berea",
          "Bergamo","Bergen op Zoom","Bergisch Gladbach","Berlin",
          "Bernau bei Berlin","Besancon","Best","Bethlehem","Bhopal",
          "Bialystok","Biarritz","Biberach","Bicester","Bielefeld",
          "Bielsko-Biala","Bien Hoa","Bietigheim-Bissingen","Bilbao",
          "Binfield","Birmingham","Birobidzhan","Bissen","Bitola",
          "Blackburn","Blackpool","Blacksburg","Bladel","Blagoevgrad",
          "Blainville","Bletchley","Bloemfontein","Blumenau",
          "Boa Vista","Boardman","Boblingen","Boca Raton","Bochum",
          "Bodo","Bogota","Boise","Boksburg","Bologna","Bonn",
          "Boras","Borculo","Bordeaux","Boston","Bota","Botucatu",
          "Boucherville","Bovisio-Masciago","Bowling Green","Bracknell",
          "Bradford","Bramham cum Oglethorpe","Brampton","Brasilia",
          "Brasov","Bratislava","Brcko","Bremen","Brescia","Bresson",
          "Brest","Bridgend","Bridgetown","Bridgwater","Brighton",
          "Brisbane","Bristol","Brno","Bromsgrove","Brooklyn Park",
          "Brunswick","Brussels","Bucaramanga","Bucharest","Bucheon-si",
          "Budapest","Buenos Aires","Buffalo","Bunkyo","Burgess Hill",
          "Burlingame","Burnley","Burscheid","Bury","Burzaco",
          "Busan","Bushey","Bussolengo","Bydgoszcz","Cabo Frio",
          "Cacador","Cadiz","Cagayan de Oro","Cagliari","Cagua",
          "Cairo","Calabar","Calamba","Calarasi","Calgary","Cali",
          "Camberley","Cambridge","Campeche","Campina Grande",
          "Campinas","Campo Grande","Campos dos Goytacazes","Canberra",
          "Cancun","Canterbury","Canton","Capbreton","Cape Town",
          "Capelle aan den IJssel","Caracas","Carapicuiba","Cardiff",
          "Carlos Barbosa","Carlow","Carson","Casablanca","Casalecchio di Reno",
          "Cascais","Cascavel","Castel Maggiore","Castelfranco Veneto",
          "Castenedolo","Castries","Catania","Catarroja","Caxias do Sul",
          "Cebu City","Celje","Central Coast","Centurion","Cergy",
          "Cesena","Cestas","Chambly","Champs-sur-Marne","Chandigarh",
          "Chania","Chapeco","Charleroi","Charleston","Chelmsford",
          "Chelyabinsk","Chennai","Chernihiv","Chernivtsi","Chicago",
          "Chilliwack","Chisinau","Chiyoda","Chongqing","Chorley",
          "Chorzow","Christchurch","Chula Vista","Chungju-si",
          "Chuo","Chur","Chutung Township","Ciudad Mendoza","Ciudad Nezahualcoyotl",
          "Ciudad del Carmen","Claremont","Clearwater","Cleethorpes",
          "Clemson","Clermont-Ferrand","Clinton","Cluj-Napoca",
          "Cochabamba","Coevorden","Coffeyville","Coimbatore",
          "Colchester","Coleraine","College Station","Collinsville",
          "Cologne","Colombo","Colomiers","Colorado Springs",
          "Colton","Columbia","Columbus","Como","Concepcion del Uruguay",
          "Concord","Conroe","Constanta","Conway","Conwy","Copenhagen",
          "Cordoba","Corrientes","Corum","Cosenza","Cotia","Cottbus",
          "Courbevoie","Coventry","Craiova","Cremona","Crewe",
          "Croydon","Cuautitlan Izcalli","Cucuta","Cuernavaca",
          "Cuiaba","Cuneo","Cupertino","Curitiba","Czestochowa",
          "Da Nang","Dabrowa Gornicza","Daegu","Daejeon","Dakar",
          "Dallas","Dallas","Dalmine","Damanhour","Damascus",
          "Damietta","Dammam","Darmstadt","Dartmouth","Dartmouth",
          "Daugavpils","Davao City","Daventry","De Pere","Debrecen",
          "Dedemsvaart","Deerfield Beach","Delft","Den Helder",
          "Denizli","Denpasar","Derby","Dhaka","Diadema","Dijon",
          "Dinxperlo","Divinopolis","Dnepropetrovsk","Dniprodzerzhyns'k",
          "Dobre Miasto","Doha","Dois Irmaos","Dombivli","Donaueschingen",
          "Donetsk","Doral","Dornbirn","Dortmund","Dourados",
          "Dresden","Dubendorf","Dublin","Dublin","Dubna","Duisburg",
          "Duiven","Duluth","Dundee","Dunfermline","Dunstable",
          "Duque de Caxias","Durban","Dusseldorf","East Brunswick",
          "East Grinstead","East Lansing","East London","Eastbourne",
          "Ebeltoft","Edenvale","Edinburgh","Edmonton","Eger",
          "Eindhoven","Eisenach","El Ejido","El Paso","El Puerto de Santa Maria",
          "Elblag","Ellwangen","Elmshorn","Elsah","Elx","Emmen",
          "Engels","Enschede","Erd","Erding","Erfurt","Erkner",
          "Erlangen","Erode","Erp","Errenteria","Esbjerg","Escondido",
          "Espoo","Estaires","Ettlingen","Eugene","Evora","Exeter",
          "Fairbanks","Fairborn","Fairfield","Falkensee","Falkirk",
          "Falun","Faridabad","Farnborough","Fernandopolis","Ferozepur",
          "Ferrara","Filakovo","Filderstadt","Finsterwalde","Florence",
          "Florianopolis","Fort Lauderdale","Fort Worth","Fortaleza",
          "Foshan","Foz do Iguacu","Framingham","Franca","Frankfurt",
          "Frechen","Fredericksburg","Frederiksberg","Freehold Township",
          "Freiberg","Freiburg","Frenstat","Fresno","Friedberg",
          "Fruit Cove","Frydek-Mistek","Frydlant nad Ostravici",
          "Fukui","Funabashi","Gahanna","Gainesville","Galati",
          "Galveston","Galway","Gandhinagar","Gandia","Garland",
          "Gatineau","Gdansk","Gdynia","Gebze","Geelong","Geesthacht",
          "Gelsenkirchen","General Trias","Geneva","Gennep","Genoa",
          "George","Gernika-Lumo","Ghaziabad","Ghent","Gimhae-si",
          "Gioia Tauro","Girona","Gisors","Giza","Gjovik","Glasgow",
          "Gliwice","Gloucester","Godalming","Godollo","Goiania",
          "Gold Coast","Gomel","Gorgan","Gorinchem","Gorlitz",
          "Gotha","Gothenburg","Gottingen","Gouda","Granada",
          "Grave","Graz","Greater Sudbury","Greensboro","Greenville",
          "Greenwood","Greer","Greifswald","Grenoble","Grimma",
          "Grimstad","Groesbeek","Groningen","Guadalajara","Guadalajara",
          "Guangzhou","Guatemala City","Guildford","Guimaraes",
          "Gunpo-si","Gurgaon","Gwangmyeong-si","Gwangyang-si",
          "Gyal","Gyomro","Ha","Haan","Haarlem","Hachioji","Hackensack",
          "Hadano","Hadera","Hagen","Hai Phong","Haifa","Halle (Saale)",
          "Halmstad","Hamburg","Hamedan","Hamilton","Haney","Hangzhou",
          "Hann. Munden","Hanoi","Hanover","Harare","Harpenden",
          "Harrogate","Harsefeld","Harstad","Hartlepool","Hawarden",
          "Hawes","Hazleton","Heel","Heidelberg - GP","Heilbronn",
          "Hellevoetsluis","Helmond","Helsinki","Hemel Hempstead",
          "Heraklion","Herceg Novi Municipality","Hernani","Heroica Veracruz",
          "High Wycombe","Highland Heights","Highmore","Hillerod",
          "Hillsboro","Hilton","Himeji","Hlucin","Ho Chi Minh City",
          "Hohentengen am Hochrhein","Holbaek","Hong Kong","Honolulu",
          "Hoofddorp","Horsens","Horst","Horw","Houston","Huddersfield",
          "Huelva","Huizen","Huntington Park","Hurlingham","Hvidovre",
          "Hyderabad","IJsselstein","Iasi","Ibadan","Idaho Falls",
          "Imphal","Incheon","Indianapolis","Indore","Innsbruck",
          "Inverness","Ipatinga","Ipoh","Ipswich","Irapuato",
          "Irkutsk","Irlam","Irvine","Irving","Isfahan","Islamabad",
          "Ismaning","Ispra","Issoudun","Istanbul","Itajai","Itajuba",
          "Itatiba","Itzehoe","Ivaipora","Ivano-Frankivsk","Ivanovo",
          "Ivry-sur-Seine","Ixelles","Izhevsk","Izmir","Jacksonville",
          "Jacksonville","Jagodina","Jaipur","Jakarta","Jakobsberg",
          "Jalandhar","Janesville","Jaragua do Sul","Jaroslaw",
          "Jarvenpaa","Jayapura","Jazan","Jeddah","Jelenia Gora",
          "Jena","Joao Pessoa","Johannesburg","Johannesburg South",
          "Johnson City","Johor Bahru","Joplin","Joue-les-Tours",
          "Joure","Juiz de Fora","Julich","Jundiai","Kadirli",
          "Kajaani","Kalamata","Kampala","Karachi","Kardzali",
          "Kariya","Karlsruhe","Kashiwa","Kassel","Kathmandu",
          "Katowice","Kauhajoki","Kaunas","Kawanishi","Kazan",
          "Kediri","Kelkheim","Kemerovo","Kempten","Kempton Park",
          "Kennewick","Kentwood","Kerman","Khabarovsk","Khanty-Mansiysk",
          "Kharagpur","Kharkiv","Khartoum","Kherson","Khimki",
          "Khmelnytskyi","Kibaek","Kiel","Kielce","Kikinda","King of Prussia",
          "Kingston","Kirchzarten","Kirkland","Kitchener","Klang",
          "Klatovy","Kleve","Knoxville","Kobe","Koblenz","Kolkata",
          "Kollum","Kolomyya","Komarno","Koniz","Konstanz","Konya",
          "Korbach","Korneuburg","Korolyov","Korosten'","Korsor",
          "Kosice","Kostelec nad Orlici","Koszalin","Kottayam",
          "Kozani","Kozhikode","Kragujevac","Krakow","Kraljevo",
          "Kramatorsk","Krasnodar","Krasnoyarsk","Kremenets'",
          "Krnov","Kruševac","Kuala Lumpur","Kuching","Kula",
          "Kumasi","Kuopio","Kupang City","Kursk","Kurukshetra",
          "Kutna Hora","Kuwait City","Kyiv","L'Ancienne-Lorette",
          "L'Isle-d'Abeau","L'Isle-sur-la-Sorgue","La Canyada",
          "La Chapelle-sur-Erdre","La Mesa","La Paz","La Plata",
          "La Roche-sur-Foron","La Roche-sur-Yon","La Rochelle",
          "La Teste-de-Buch","La Victoria","Ladera Ranch","Lafayette",
          "Lages","Lagos","Lagos","Laguna Niguel","Lahore","Lake Forest",
          "Lakewood","Lancaster","Lancaster","Langenau","Lapu-Lapu City",
          "Larvik","Las Arenas","Las Palmas de Gran Canaria",
          "Las Pinas","Launceston","Laurinburg","Lausanne","Le Havre",
          "Le Mans","Le Rheu","Lebork","Lecce","Leeds","Leer",
          "Leeuwarden","Lehrte","Leicester","Leinfelden-Echterdingen",
          "Leipzig","Leon","Lermoos","Leuven","Lewknor","Lexington",
          "Liancourt","Liberec","Liege","Lier","Lille","Limeira",
          "Lincoln","Lincoln","Lingen","Linhares","Linkoping",
          "Linz","Lisbon","Little Rock","Liverpool","Ljubljana",
          "Lodz","Logan","Logrono","Lome","London","London","London",
          "Londrina","Long Beach","Long Beach","Lorca","Lorena",
          "Los Angeles","Los Teques","Louisville","Louny","Lublin",
          "Lucerne","Lucknow","Ludhiana","Ludwigsburg","Luhansk",
          "Lunel","Lurgan","Lustenau","Luton","Lutsk","Luxemburg City",
          "Lviv","Lyngby","Lynn","Lyon","Lyubertsy","Maarssenbroek",
          "Macapa","Macau","Maceio","Macerata","Macon","Madison",
          "Madison","Madona","Madrid","Madurai","Magdeburg","Maia Municipality",
          "Maidenhead","Maidstone","Mainz","Makassar","Makati",
          "Mako","Malaga","Malang","Malcesine","Male","Malmo",
          "Malvern","Manaus","Manchester","Mandaluyong","Manila",
          "Manisa","Mannheim","Mansfield","Mantes-la-Ville","Mar del Plata",
          "Maracaibo","Maracay","Marburg","Marcos Juarez","Mardin",
          "Mariana","Marianske Lazne","Maribor","Maringa","Mariupol'",
          "Marmaris","Mars","Marseille","Martigny","Martin","Martin",
          "Maryborough","Maryville","Matamoros","Mataram","Mayaguez",
          "Mecca","Mechelen","Medan","Medellin","Medford","Medford",
          "Medias","Melbourne","Melton Mowbray","Menifee","Merelbeke",
          "Merida","Merida","Meridian","Mettmann","Metz","Meudon",
          "Mexico City","Mezohegyes","Miass","Michalovce","Middletown",
          "Midland","Midrand","Mielec","Miesbach","Milan","Milton Keynes",
          "Minden","Minsk","Mishawaka","Miskolc","Modena","Moers",
          "Mohacs","Mohali","Mol","Molins de Rei","Molndal","Mombasa",
          "Monchengladbach","Moncton","Monmouth","Monroe Township",
          "Mons","Montclair","Monteria","Monterrey","Montesilvano",
          "Montevideo","Monticello","Montreal","Monza","Morrison",
          "Morwell","Moscow","Motala","Mount Dora","Mountain View",
          "Msida","Mueang Chiang Mai District","Mueang Songkhla District",
          "Muhlhausen","Mulheim","Mumbai","Muncie","Munich","Municipality of Sostanj",
          "Munsingen","Munster","Murcia","Muri bei Bern","Murom",
          "Myjava","Mykolaiv","Mysore","Mytishchi","Naberezhnye Chelny",
          "Nachod","Nagoya","Nagpur","Nagykanizsa","Nairobi",
          "Nakuru","Namur","Namyangju-si","Nanaimo","Nancy","Nanterre",
          "Nantes","Naperville","Naples","Narva","Nashik","Natal",
          "Navapolatsk","Navi Mumbai","Neckarsulm","Neerpelt",
          "Neosho","Neubrandenburg","Neuenkirch","Neuwied","New Brunswick",
          "New Cairo City","New Delhi","New York","Newark","Newberg",
          "Newbury","Newcastle upon Tyne","Newton","Niamey","Nice",
          "Nicosia","Niederkruchten","Niort","Nis","Niteroi",
          "Nitra","Nizhny Novgorod","Noale","Noida","Norderstedt",
          "Nordhausen","Norrkoping","North Bethesda","North Canton",
          "Northampton","Northampton","Norwich","Nottingham",
          "Nova Iguacu","Novara","Nove Mesto na Morave","Novi Sad",
          "Novo Hamburgo","Novo Mesto","Novohrad-Volyns'kyi",
          "Novokuybyshevsk","Novosibirsk","Novy Jicin","Nowogard",
          "Nowy Sacz","Nuestra Senora de La Paz","Nuneaton","Nuremberg",
          "Nysa","Obninsk","Odense","Odessa","Oeiras","Offenbach",
          "Offenburg","Oklahoma City","Oldenburg","Oldham","Olomouc",
          "Olsztyn","Omagh","Omaha","Omsk","Oosterhout","Opole",
          "Oppenweiler","Oranjestad","Orcutt","Orebro","Orenburg",
          "Orleans","Orlova","Oryol","Orzysz","Osaka","Osasco",
          "Osijek","Oslo","Osnabruck","Osterode am Harz","Ostrach",
          "Ostrava","Oswiecim","Ottawa","Oudenaarde","Oulu","Ouro Preto",
          "Pachuca","Padang","Paderborn","Padua","Paignton","Palangka Raya",
          "Palembang","Palermo","Palma de Mallorca","Palo Alto",
          "Panevezys","Panjim","Panningen","Papa","Paphos","Para de Minas",
          "Paramount","Paramus","Parana","Paranaque","Pardes Hanna-Karkur",
          "Pardubice","Paris","Paris","Park City","Parker","Parkland",
          "Parnu","Pasig","Patiala","Pato Branco","Pau","Pavia",
          "Pavlodar","Pavlovsky Posad","Payerne","Pekan","Pekanbaru",
          "Penticton","Perm","Perpignan","Perth","Pervomais'k",
          "Pesaro","Peshawar","Pessac","Petah Tikva","Petaling Jaya",
          "Peterborough","Petergof","Petersfield","Pforzheim",
          "Philadelphia","Phnom Penh","Phoenix","Piacenza","Pico Rivera",
          "Pietermaritzburg","Pilani","Pimpri Chinchwad","Pinczow",
          "Pineto","Pinetown","Pingtung City","Pinkafeld","Pinto",
          "Piove di Sacco","Piracicaba","Pisa","Piscataway Township",
          "Pitesti","Pittsburgh","Pittsfield","Plains","Plano",
          "Plantation","Plauen","Plettenberg Bay","Plock","Ploiesti",
          "Plovdiv","Plymouth","Plymouth Township","Plzen","Podgorica",
          "Podolsk","Pohang-si","Pointe-Claire","Poissy","Policka",
          "Polokwane","Pompei","Ponchatoula","Ponta Delgada",
          "Ponta Grossa","Pontevedra","Pontianak","Porsgrunn",
          "Port Elizabeth","Port Louis","Port Macquarie","Port-of-Spain",
          "Portalegre","Portimao Municipality","Porto","Porto Alegre",
          "Porto Salvo","Porto Seguro","Portsmouth","Portsmouth",
          "Posadas","Potomac Falls","Potsdam","Potters Bar","Poznan",
          "Prague","Prenzlau","Pretoria","Pribram","Prievidza",
          "Prijedor","Princeton","Prnjavor","Puducherry","Puebla",
          "Puerto La Cruz","Pulheim","Pune","Purmerend","Putrajaya",
          "Pyskowice","Qom","Quebec City","Quetta","Quezon City",
          "Quimper","Quito","Quy Nhon","Rabat","Radolfzell","Radom",
          "Rafaela","Rajkot","Ranchi","Randburg","Rapid City",
          "Ravenna","Ravensburg","Rawalpindi","Reading","Recife",
          "Redding","Redditch","Regensburg","Remscheid","Rennerod",
          "Rennes","Renton","Resana","Resistencia","Retford",
          "Reutlingen","Rexburg","Reynoldsburg","Rhodes","Ried im Innkreis",
          "Riga","Rijeka","Rijssen","Rijswijk","Rimini","Rimouski",
          "Rio Cuarto","Rio Tercero","Rio de Janeiro","Rivarolo Canavese",
          "Riverside","Rivne","Riyadh","Rochester","Rochford",
          "Rockanje","Rocky Mountain House","Roissy-en-Brie",
          "Rome","Rome","Rondonopolis","Roodepoort","Rosario",
          "Roseau","Roseville","Roskilde","Rostock","Rostov-on-Don",
          "Rottenburg","Rotterdam","Rottweil","Rouen","Rovereto",
          "Royal Leamington Spa","Royston","Rubtsovsk","Ruda Slaska",
          "Ruse","Rushden","Rutland","Ry","Ryazan","Rybinsk",
          "Rzeszow","Saarbrucken","Sabadell","Sackville","Saint Denis",
          "Saint Gallen","Saint Paul","Saint Petersburg","Saint-Denis",
          "Saint-Hilaire-de-Riez","Saint-Jory","Saint-Laurent-de-la-Salanque",
          "Saint-Maur-des-Fosses","Saint-Sulpice-la-Pointe","Sainte-Foy-les-Lyon",
          "Salach","Salatiga","Salem","Salem","Salford","Salinas",
          "Salta","Salvador","Salzburg","Salzgitter","Samara",
          "Sammamish","Samsun","San Andres de Giles","San Antonio",
          "San Bernardino","San Diego","San Felipe","San Francisco",
          "San Gwann","San Jose","San Jose","San Luis Potosi",
          "San Miguel de Tucuman","San Pedro","San Salvador",
          "San Salvador de Jujuy","San Sebastian de los Reyes",
          "Sana'a","Sande","Sandton","Sandy Springs","Sankt Augustin",
          "Santa Barbara","Santa Cruz de Tenerife","Santa Cruz de la Sierra",
          "Santa Fe","Santa Maria","Santarem","Santiago","Santiago de Queretaro",
          "Santo Domingo","Santo Tirso","Santos","Sao Bernardo do Campo",
          "Sao Jose dos Campos","Sao Leopoldo","Sao Luis","Sao Paulo",
          "Sapporo","Sarajevo","Saransk","Saskatoon","Sayville",
          "Schaffhausen","Schaumburg","Schiltigheim","Schloss Holte-Stukenbrock",
          "Schwabisch Hall","Schwandorf","Schwerte","Scottsville",
          "Seattle","Seclin","Seixal","Semarang","Seongnam-si",
          "Seosan-si","Seoul","Sestri Levante","Setagaya","Sete Lagoas",
          "Setif","Seville","Sfantu Gheorghe","Shah Alam","Shanghai",
          "Sharjah","Sheffield","Shelton","Shenzhen","Shepperton",
          "Sherbrooke","Shimla","Shinjuku","Shiraz","Shtip","Sibiu",
          "Sidi Bel Abbes","Sidney","Siegen","Singapore","Sint-Jans-Molenbeek",
          "Sint-Truiden","Sintra","Sivas","Skopje","Skovde","Slough",
          "Smithfield","Smyrna","Socastee","Sofia","Solingen",
          "Solnechnogorsk","Solon","Soma","Sonderborg","Sondrio",
          "Sopot","Sopron","Sorocaba","Sosnowiec","South Brunswick Township",
          "South St. Paul","South Tangerang","Southampton","Southport",
          "Spalding","Spijkenisse","Spisska Nova Ves","Split",
          "Spokane","Spokane Valley","Spring Hill","Springfield",
          "Sremska Mitrovica","St. Louis","Stafford","Stara Zagora",
          "Starogard Gdanski","Staufen","Stavropol","Steenwijk",
          "Steinfurt","Sterling Heights","Stevenage","Steyning",
          "Stillwater","Stockholm","Stockport","Stockton-on-Tees",
          "Stoke-on-Trent","Stralsund","Strangnas","Strasbourg",
          "Stuhr","Stuttgart","Suez","Sulzbach","Sun Prairie",
          "Sundsvall","Sunnyvale","Surabaya","Surat","Surgut",
          "Surrey","Suwanee","Suwon-si","Suzhou","Swakopmund",
          "Sydney","Szczecin","Szombathely","Tabriz","Tadcaster",
          "Taif","Tainan City","Tallinn","Tampere","Tandil","Tangerang",
          "Taoyuan City","Tapejara","Targu Jiu","Targu Mures",
          "Tarnow","Tartu","Tashkent","Tata","Tatui","Taubate",
          "Taunton","Tbilisi","Tegelen","Tegucigalpa","Tehran",
          "Teixeira de Freitas","Tel Aviv","Temirtau","Tempe",
          "Temse","Temuco","Tepic","Ternopil","Terrassa","Texarkana",
          "Texcoco","Thane","The Hague","Thessaloniki","Thimphu",
          "Thionville","Thiruvananthapuram","Thunder Bay","Tianjin",
          "Tigard","Tilburg","Timisoara","Tipton","Tirana","Tiruchirappalli",
          "Tlmace","Toledo","Toluca","Tomar Municipality","Tomilino",
          "Toms River","Toronto","Torrance","Torreglia","Torreon",
          "Torres Vedras","Torrevieja","Toulon","Toulouse","Tours",
          "Trebic","Trencin","Treviso","Trier","Trinec","Trnava",
          "Trollhattan","Trondheim","Troy","Tsukuba","Tubingen",
          "Tucson","Tunica","Tunis","Turin","Turku","Tuttlingen",
          "Tuzla Canton","Tysons Corner","Tyumen","Uberaba","Uberlandia",
          "Udine","Ufa","Uherske Hradiste","Uiwang-si","Ulan-Ude",
          "Ullensaker","Ulm","Unna","Untergruppenbach","Urmia",
          "Ushuaia","Usti nad Orlici","Utrecht","Uzhhorod","Vaasa",
          "Vadodara","Valbonne","Valence","Valencia","Valencia",
          "Valenzuela City","Valera","Valley Stream","Vancouver",
          "Vanderbijlpark","Varel","Varese","Vaxjo","Veenendaal",
          "Vefsn","Velbert","Veliko Tarnovo","Velingrad","Velke Mezirici",
          "Velsen","Venice","Ventspils","Versailles","Verviers",
          "Veszprem","Vicenza","Vicosa","Victoria","Vienna","Vigo",
          "Vijayawada","Vila Nova de Famalicao","Vila Nova de Gaia Municipality",
          "Villach","Villeurbanne","Vilnius","Vinhedo","Viseu",
          "Vitebsk","Vitoria","Vladikavkaz","Vladivostok","Vlasikha",
          "Voitsberg","Vojens","Volgograd","Vologda","Voronezh",
          "Vrchlabi","Vrilissia","Vsevolozhsk","Wageningen","Walsall",
          "Wantage","Waren","Warendorf","Warrington","Warsaw",
          "Washington","Washington","Watford","Waynesburg","Weaverville",
          "Wedel","Weiden","Weinheim","Wellington","Wembley",
          "Wervik","West Covina","West Des Moines","West Jordan",
          "West Lafayette","West Palm Beach","Wevelgem","Widnes",
          "Wiefelstede","Wiehl","Wierden","Wiesbaden","Wietmarschen",
          "Wigan","Wilkes-Barre","Wilkinsburg","Williams Lake",
          "Wilsonville","Winchester","Winchester","Windeck","Windsor",
          "Windsor","Winnipeg","Winsen","Winsen an der Aller",
          "Winston-Salem","Winterthur","Wodzislaw Slaski","Woking",
          "Wokingham","Wolfsburg","Woodside","Worcester","Wroclaw",
          "Wunstorf","Wurzburg","Wyndham","Xabia","Xalapa","Xiamen",
          "Yekaterinburg","Yeosu-si","Yeovil","Yerevan","Yogyakarta",
          "Yokohama","Yongin-si","York","Zaandam","Zabrze","Zadar",
          "Zagazig","Zagreb","Zakopane","Zalaegerszeg","Zalec",
          "Zapopan","Zaporizhia","Zaragoza","Zaria","Zelenograd",
          "Zheleznogorsk","Zhongli City","Zhukovsky","Zielona Gora",
          "Zilina","Zittau","Zlatoust","Zlotow","Zossen","Zug",
          "Zurich","Zwolle"];


      var locationsArray2 = [
          "A Coruna","Aachen","Aalborg","Aarhus","Aars","Aberdeen",
          "Abha","Abidjan","Abingdon","Abu Dhabi","Abuja","Accra",
          "Acworth","Adana","Adeje","Adelaide","Afyonkarahisar",
          "Aguascalientes","Ahmedabad","Ahvaz","Aix-en-Provence",
          "Ajaccio","Ajalvir","Aksaray","Al Ain","Alajuela","Alanya",
          "Alappuzha","Alba Iulia","Albacete","Albany","Albany",
          "Albufeira","Albuquerque","Alcobendas","Alcoi","Aldenhoven",
          "Aldershot","Alexandria","Algemesi","Algiers","Alicante",
          "Alkmaar","Allahabad","Almada","Almelo","Almere","Almeria",
          "Almetyevsk","Altenburg","Altstatten","Americana","Amiens",
          "Amsterdam","Amsterdam-Zuidoost","Amã","Anantapur",
          "Anapa","Andenne","Andernach","Andorra la Vella","Ankara",
          "Annaba","Annandale-on-Hudson","Ansonia","Antwerp",
          "Anyang-si","Apeldoorn","Aracatuba","Araxa","Arcadia",
          "Ardea","Argenteuil","Arica","Arlington","Armenia",
          "Arnhem","Arrasate","Arsenyev","Artemivs'k","Arvada",
          "Arzamas","Aschaffenburg","Ashburn","Ashland","Asker",
          "Assen","Asten","Asti","Asuncion","Athens","Atlanta",
          "Auckland","Augsburg","Aurangabad","Aurora","Austin",
          "Aveiro Municipality","Avignon","Babolsar","Bacau",
          "Bad Aibling","Bad Kreuznach","Bad Langensalza","Bad Mergentheim",
          "Bad Salzungen","Bad Vilbel","Baden bei Wien","Bage",
          "Baghdad","Bahawalpur","Bahia Blanca","Bainbridge Island",
          "Baku","Balatonfured","Balikesir","Ballerup","Balneario Camboriu",
          "Banbridge","Bandar Abbas","Bandar Lampung","Bandar Seri Begawan",
          "Bandung","Bangalore","Bangkok","Banja Luka","Banjarmasin",
          "Banska Bystrica","Barcelona","Barcelona","Bardejov",
          "Bardstown","Bargteheide","Bari","Barnaul","Barnstable",
          "Barquisimeto","Barra Velha","Barrie","Barueri","Barzano",
          "Basingstoke","Batam","Bataysk","Bath","Baton Rouge",
          "Bauru","Bautzen","Bay Shore","Bayan Lepas","Bayonet Point",
          "Bayreuth","Bedford","Beijing","Beirut","Beja","Bejaia",
          "Bekasi","Belem","Belfast","Belgaum","Belgorod","Belgrade",
          "Bellaire","Bellevue","Bellingham","Bellingwolde","Belo Horizonte",
          "Belper","Belvidere","Benidorm","Benoni","Bensenville",
          "Bensheim","Berea","Bergamo","Bergen op Zoom","Berkeley",
          "Berlin","Bermeo","Bernau bei Berlin","Berne","Besancon",
          "Best","Bethlehem","Beverly Hills","Beziers","Bhilai",
          "Bhopal","Bhubaneshwar","Bialystok","Biarritz","Biberach",
          "Bicester","Bielefeld","Bielsko-Biala","Bietigheim-Bissingen",
          "Bilbao","Bingen","Birmingham","Birobidzhan","Bishkek",
          "Bissen","Bitola","Blackburn","Blacksburg","Bladel",
          "Blainville","Bletchley","Bloemfontein","Bloomington",
          "Blumenau","Boa Vista","Boardman","Boblingen","Boca Raton",
          "Bochum","Bognor Regis","Bogor","Bogota","Boksburg",
          "Bologna","Bolton","Bonn","Boras","Borculo","Bordeaux",
          "Borehamwood","Boskoop","Boston","Bota","Boucherville",
          "Boulder","Boulogne-Billancourt","Bowling Green","Bradford",
          "Bramham cum Oglethorpe","Brampton","Brasilia","Brasov",
          "Bratislava","Brcko","Bremen","Brescia","Bresson","Brest",
          "Bridgend","Brighton","Brighton","Brisbane","Bristol",
          "Brno","Brooklyn Park","Brunswick","Brussels","Bryansk",
          "Bucaramanga","Bucharest","Bucheon-si","Budapest","Buenos Aires",
          "Buffalo","Bunkyo","Burscheid","Bury","Burzaco","Busan",
          "Bushey","Bydgoszcz","Cabo Frio","Cacador","Cadiz",
          "Cagayan de Oro","Cagua","Cairo","Calabar","Calarasi",
          "Calgary","Cali","Cambridge","Campeche","Campinas",
          "Campo Grande","Campos dos Goytacazes","Canakkale",
          "Canberra","Cancun","Canterbury","Canton","Capbreton",
          "Cape Town","Capelle aan den IJssel","Caracas","Carapicuiba",
          "Cardiff","Carlos Barbosa","Carlow","Carson","Casablanca",
          "Cascais","Cascavel","Caserta","Castel Maggiore","Castelfranco Veneto",
          "Castries","Catania","Catarroja","Caxias do Sul","Cebu City",
          "Celaya","Celje","Central Coast","Centurion","Cerritos",
          "Cesena","Cestas","Chalon-sur-Saone","Chambery","Chambly",
          "Champs-sur-Marne","Chandigarh","Chapeco","Chapel Hill",
          "Charleroi","Charleston","Charlotte","Charlottesville",
          "Chelles","Chelmsford","Chelyabinsk","Chennai","Chernihiv",
          "Chernivtsi","Chicago","Chisinau","Chiyoda","Chongqing",
          "Chorzow","Christchurch","Chula Vista","Chungju-si",
          "Chuo","Chur","Chutung Township","Ciudad Mendoza","Ciudad Nezahualcoyotl",
          "Ciudad del Carmen","Claremont","Clayton","Clearwater",
          "Cleckheaton","Cleethorpes","Clemson","Clermont-Ferrand",
          "Clinton","Cluj-Napoca","Cochabamba","Coevorden","Coffeyville",
          "Coimbatore","Colchester","Coleraine","College Park",
          "College Station","Collinsville","Colmar","Cologne",
          "Colombo","Colomiers","Colton","Columbia","Columbus",
          "Como","Concepcion del Uruguay","Concord","Conroe",
          "Conselheiro Lafaiete","Constantine","Conwy","Copenhagen",
          "Cordoba","Corrientes","Corum","Cosenza","Cotia","Cottbus",
          "Courbevoie","Coventry","Craiova","Crawley","Cremona",
          "Crewe","Croydon","Cuautitlan Izcalli","Cucuta","Cuernavaca",
          "Cuiaba","Cuneo","Cupertino","Curitiba","Czestochowa",
          "Da Nang","Daegu","Daejeon","Dakar","Dallas","Dallas",
          "Dalmine","Damanhour","Damascus","Damietta","Dammam",
          "Dar es Salaam","Darmstadt","Dartmouth","Dartmouth",
          "Daugavpils","Davao City","Daventry","Davis","De Lier",
          "De Pere","Debica","Debrecen","Dedemsvaart","Deerfield Beach",
          "Delft","Den Ham","Den Helder","Denderleeuw","Denia",
          "Denizli","Denpasar","Derby","Detmold","Deva","Dhaka",
          "Diadema","Dijon","Dinxperlo","Divinopolis","Dnepropetrovsk",
          "Dniprodzerzhyns'k","Dobre Miasto","Doha","Dombivli",
          "Donaueschingen","Donetsk","Doral","Dornbirn","Dortmund",
          "Douala","Dourados","Dresden","Dubai","Dubendorf","Dublin",
          "Dublin","Dubna","Duisburg","Duiven","Duluth","Dundalk",
          "Dundee","Dunstable","Durango","Durban","Duren","Durham",
          "Dusseldorf","Eagan","Eagle Mountain","East Brunswick",
          "East Grinstead","East Lansing","East London","Eastbourne",
          "Edenvale","Edinburgh","Edirne","Edmonton","Eersel",
          "Eger","Eindhoven","Eisenach","El Dorado Hills","El Ejido",
          "El Paso","El Puerto de Santa Maria","Elblag","Elista",
          "Ellwangen","Elmshorn","Elsah","Elsterwerda","Elx",
          "Ely","Emmen","Enkhuizen","Enkoping","Enschede","Erd",
          "Erding","Erfurt","Erlangen","Erlensee","Ernakulam",
          "Erp","Esbjerg","Esher","Espoo","Esslingen","Estaires",
          "Ettlingen","Eugene","Everett","Evergreen","Evora",
          "Exeter","Fairbanks","Fairborn","Fairfield","Fairport",
          "Falkensee","Falkirk","Falun","Faridabad","Farnborough",
          "Feasterville-Trevose","Fernandopolis","Ferozepur",
          "Ferrara","Filakovo","Filderstadt","Finsterwalde","Florence",
          "Florianopolis","Formigine","Fort Lauderdale","Fort Lee",
          "Fortaleza","Foshan","Foz do Iguacu","Framingham","Frankenthal",
          "Frankfurt","Frechen","Fredericksburg","Frederiksberg",
          "Freehold Township","Freeland","Freiberg","Freiburg",
          "Frenstat","Friedberg","Friedrichshafen","Fruit Cove",
          "Fukui","Funabashi","Gaggenau","Gainesville","Galati",
          "Galloway","Galveston","Galway","Gandhinagar","Gandia",
          "Garland","Gateshead","Gatineau","Gdansk","Gdynia",
          "Gebze","Geelong","Geesthacht","Gelsenkirchen","Gelugor",
          "General Trias","Geneva","Gennep","George","Gera","Germering",
          "Gernika-Lumo","Ghent","Gimhae-si","Gioia Tauro","Gisors",
          "Giza","Gjovik","Glasgow","Glauchau","Glendale","Gliwice",
          "Gloucester","Godalming","Godollo","Goiania","Gold Coast",
          "Gomel","Gorgan","Gorlitz","Gossau","Gotha","Gouda",
          "Granada","Grave","Graz","Greater Sudbury","Greensboro",
          "Greenville","Greenwood","Greer","Greifswald","Grenoble",
          "Grimma","Grimstad","Groesbeek","Gronau","Groningen",
          "Guacara","Guadalajara","Guangzhou","Guaratingueta",
          "Guatemala City","Guayana City","Guebwiller","Guildford",
          "Guimaraes","Gunpo-si","Gurgaon","Guwahati","Gwangmyeong-si",
          "Gyal","Gyomro","Gyongyos","Ha","Haan","Haarlem","Hachioji",
          "Hackensack","Hadera","Haifa","Halesowen","Halle (Saale)",
          "Halmstad","Hamburg","Hamedan","Hamilton","Hamilton",
          "Haney","Hangzhou","Hanoi","Hanover","Harare","Harpenden",
          "Harrogate","Harsefeld","Harstad","Hartlepool","Hazleton",
          "Heel","Heerhugowaard","Heidelberg","Heilbronn","Hellevoetsluis",
          "Helmond","Helsinge","Helsinki","Hemel Hempstead","Hennigsdorf",
          "Heraklion","Hernani","Heroica Veracruz","High Wycombe",
          "Highland Heights","Highmore","Hillerod","Hillsboro",
          "Hilton","Himeji","Hinnerup","Hlucin","Ho Chi Minh City",
          "Hobart","Hoensbroek","Hohentengen am Hochrhein","Holbaek",
          "Hong Kong","Honolulu","Hoorn","Horsens","Horw","Houston",
          "Hove","Huckelhoven","Huddersfield","Hue","Huelva",
          "Huizen","Hunters Creek","Huntington Park","Hvidovre",
          "Hyderabad","IJsselstein","Iasi","Iglesias","Imphal",
          "Incheon","Indianapolis","Indore","Innsbruck","Inowroclaw",
          "Inverness","Ipatinga","Ipoh","Ipswich","Irapuato",
          "Irkutsk","Irlam","Irvine","Irving","Isfahan","Islamabad",
          "Ispra","Issoudun","Istanbul","Itajuba","Ivano-Frankivsk",
          "Ivanovo","Ivry-sur-Seine","Izhevsk","Izmir","Jackson",
          "Jacksonville","Jacksonville","Jaen","Jagodina","Jaipur",
          "Jakarta","Jakobsberg","Jalandhar","Jamshedpur","Janesville",
          "Jaroslaw","Jasper","Jazan","Jeddah","Jelenia Gora",
          "Jena","Jicin","Joao Pessoa","Johannesburg","Johannesburg South",
          "Johnson City","Johor Bahru","Joue-les-Tours","Joure",
          "Juiz de Fora","Jundiai","Kadirli","Kajaani","Kalamata",
          "Kampala","Kansas City","Kaposvar","Karachi","Kariya",
          "Karlsruhe","Kartuzy","Kashiwa","Kassel","Katowice",
          "Kauhajoki","Kaunas","Kawanishi","Kaysville","Kazan",
          "Kediri","Kempton Park","Kentwood","Kerman","Kettering",
          "Kfar Saba","Khabarovsk","Khanty-Mansiysk","Kharagpur",
          "Kharkiv","Kherson","Khimki","Kibaek","Kiel","Kikinda",
          "King of Prussia","Kingston","Kissimmee","Klaipeda",
          "Klang","Klatovy","Klerksdorp","Kleve","Knoxville",
          "Kobe","Koblenz","Kolkata","Kollum","Komarno","Konstanz",
          "Konya","Korbach","Korneuburg","Korolyov","Korsor",
          "Kosice","Kostelec nad Orlici","Koszalin","Kottayam",
          "Kozani","Kozhikode","Kragujevac","Krakow","Kraljevo",
          "Kramatorsk","Krasnodar","Krasnoyarsk","Kremenets'",
          "Krnov","Kruševac","Kuala Lumpur","Kuching","Kula",
          "Kumasi","Kuopio","Kupang City","Kursk","Kurukshetra",
          "Kussnacht","Kutna Hora","Kuwait City","Kyiv","L'Ancienne-Lorette",
          "L'Isle-d'Abeau","L'Isle-sur-la-Sorgue","La Canyada",
          "La Mesa","La Paz","La Plata","La Roche-sur-Foron",
          "La Roche-sur-Yon","La Teste-de-Buch","Ladera Ranch",
          "Lafayette","Lages","Lagos","Lahore","Lake Forest",
          "Lakewood","Lancaster","Lancaster","Langenau","Larnaca",
          "Las Arenas","Las Pinas","Launceston","Laurinburg",
          "Lausanne","Lawrence","Le Havre","Le Kremlin-Bicetre",
          "Le Mans","Le Rheu","Lebork","Lecce","Leeds","Leer",
          "Leeuwarden","Lehrte","Leicester","Leimen","Leinfelden-Echterdingen",
          "Leipzig","Lenasia","Leon","Lermoos","Leuven","Lewknor",
          "Lexington","Lexington","Liancourt","Liege","Lille",
          "Limeira","Lincoln","Lincoln","Lingen","Linhares","Linkoping",
          "Linz","Lisbon","Little Rock","Ljubljana","Lodz","Logan",
          "Logrono","Lome","London","London","London","Londrina",
          "Long Beach","Long Beach","Lorca","Los Angeles","Los Teques",
          "Louisville","Lubeck","Lublin","Lucerne","Lucknow",
          "Ludhiana","Ludwigsburg","Luhansk","Lumberton","Lunel",
          "Lurgan","Luton","Lutsk","Luxemburg City","Lviv","Lyngby",
          "Lyon","Lyubertsy","Maarssenbroek","Maaseik","Macau",
          "Maceio","Macon","Madison","Madison","Madona","Madrid",
          "Madurai","Magdeburg","Maidenhead","Maidstone","Mainz",
          "Makassar","Makati","Mako","Malacca","Malaga","Malang",
          "Malvern","Managua","Manaus","Manchester","Mandaluyong",
          "Manila","Manisa","Mannheim","Mansfield","Mar del Plata",
          "Maracaibo","Maracay","Marburg","Marcos Juarez","Marianske Lazne",
          "Marigliano","Maringa","Mariupol'","Marl","Marlborough",
          "Marmaris","Mars","Marseille","Martigny","Martin","Maryborough",
          "Maryville","Mashhad","Matamoros","Mataram","Mathura",
          "Mayaguez","Mecca","Mechelen","Medan","Medellin","Medford",
          "Medias","Melbourne","Melton Mowbray","Menifee","Merelbeke",
          "Merida","Merida","Meridian","Mettmann","Metz","Meudon",
          "Mexico City","Mezohegyes","Miass","Michalovce","Midland",
          "Midrand","Mielec","Miercurea Ciuc","Milan","Milford",
          "Millcreek","Milton Keynes","Minden","Minsk","Mishawaka",
          "Miskolc","Mississauga","Modena","Modling","Moers",
          "Mohacs","Mol","Molins de Rei","Molndal","Monchegorsk",
          "Monchengladbach","Monor","Monroe Township","Montclair",
          "Monteria","Monterrey","Montesilvano","Montevideo",
          "Montgeron","Montreal","Monza","Morrison","Morwell",
          "Moscow","Motala","Mount Dora","Mountain View","Msida",
          "Mueang Chachoengsao District","Mueang Chiang Mai District",
          "Mueang Songkhla District","Muhlhausen","Mulheim","Mumbai",
          "Muncie","Munich","Municipality of Sostanj","Munsingen",
          "Munster","Murcia","Murfreesboro","Muri bei Bern","Murom",
          "Musselburgh","Myjava","Mykolaiv","Mysore","Mytishchi",
          "Nachod","Nagoya","Nagpur","Nagykanizsa","Nairobi",
          "Nakuru","Namur","Nanaimo","Nancy","Nanjing","Nanterre",
          "Nantes","Naperville","Naples","Narva","Nashik","Natal",
          "Naucalpan","Navapolatsk","Navi Mumbai","Neerpelt",
          "Neosho","Neubrandenburg","Neuenkirch","Neuwied","New Brunswick",
          "New Castle","New Delhi","New York","Newberg","Newbury",
          "Newcastle upon Tyne","Nice","Niederkruchten","Nijkerk",
          "Niort","Nis","Niteroi","Nitra","Nizhny Novgorod","Noale",
          "Nogales","Noida","Norderstedt","Nordhausen","Norrkoping",
          "North Canton","Northampton","Norwich","Nottingham",
          "Nova Iguacu","Novara","Nove Mesto na Morave","Nove Zamky",
          "Novi Sad","Novo Mesto","Novokuznetsk","Novosibirsk",
          "Novy Jicin","Nowy Sacz","Nuestra Senora de La Paz",
          "Nuneaton","Nuremberg","Nurtingen","Nyack","Nysa","Obninsk",
          "Odder","Odense","Oeiras","Oelde","Offenburg","Okayama",
          "Oklahoma City","Oldenburg","Oldham","Olsztyn","Omagh",
          "Omaha","Oosterhout","Opava","Opole","Oppenweiler",
          "Oranjestad","Orleans","Orlova","Oroshaza","Oryol",
          "Osaka","Osasco","Oshawa","Osijek","Oslo","Osnabruck",
          "Osterode am Harz","Ostrava","Oswiecim","Ottawa","Ottignies-Louvain-la-Neuve",
          "Oudenaarde","Oulu","Ouro Preto","Oxford","Oxford",
          "Pachuca","Padang","Paderborn","Padua","Palembang",
          "Palermo","Palma de Mallorca","Palmas","Pamplona","Panjim",
          "Paphos","Para de Minas","Paradise","Paramount","Paramus",
          "Parana","Paranaque","Pardes Hanna-Karkur","Pardubice",
          "Paris","Parker","Parma","Parnu","Pasig","Patiala",
          "Pato Branco","Pavlodar","Payerne","Pekalongan","Pekanbaru",
          "Penticton","Perm","Perpignan","Perth","Pervomais'k",
          "Peshawar","Petah Tikva","Petaling Jaya","Peterborough",
          "Petersfield","Pforzheim","Philadelphia","Phnom Penh",
          "Phoenix","Piacenza","Pico Rivera","Pietermaritzburg",
          "Pilani","Pimpri Chinchwad","Pinczow","Pinetown","Pingtung City",
          "Pinkafeld","Pinto","Piracicaba","Pisa","Piscataway Township",
          "Pitesti","Pittsburgh","Pittsfield","Plains","Plano",
          "Plantation","Plauen","Plettenberg Bay","Plock","Ploiesti",
          "Plovdiv","Plymouth","Plymouth Township","Plzen","Podgorica",
          "Podolsk","Pohlheim","Pointe-Claire","Poissy","Polokwane",
          "Pompei","Ponchatoula","Ponta Delgada","Ponta Grossa",
          "Pontianak","Poplar","Poprad","Porsgrunn","Port Elizabeth",
          "Port Louis","Port Macquarie","Port-of-Spain","Portadown",
          "Portao","Portimao Municipality","Portland","Porto",
          "Porto Alegre","Porto Salvo","Portogruaro","Portoviejo",
          "Portsmouth","Portsmouth","Potomac Falls","Poznan",
          "Prague","Prenzlau","Presov","Pretoria","Pribram","Prievidza",
          "Princeton","Prnjavor","Puchong","Puducherry","Puebla",
          "Puerto La Cruz","Pulheim","Pune","Purmerend","Putrajaya",
          "Putten","Pyatigorsk","Qom","Quartu Sant'Elena","Quebec City",
          "Quetta","Quezon City","Quito","Quy Nhon","Rabat","Radolfzell",
          "Radom","Raipur","Rajkot","Ranchi","Rancho Cordova",
          "Randburg","Rapid City","Rapperswil-Jona","Ravenna",
          "Ravensburg","Rawalpindi","Reading","Recife","Redding",
          "Regensburg","Remscheid","Rennerod","Rennes","Renton",
          "Resana","Resistencia","Retford","Reutlingen","Rexburg",
          "Reynoldsburg","Rhodes","Ribeirao Preto","Richfield",
          "Ried im Innkreis","Riga","Rijeka","Rijssen","Rimini",
          "Rimouski","Rio Cuarto","Rio Gallegos","Rio Tercero",
          "Rio de Janeiro","Rivarolo Canavese","Riverside","Riyadh",
          "Rochford","Rockanje","Rocky Mountain House","Rodez",
          "Roissy-en-Brie","Rome","Rome","Rondonopolis","Roodepoort",
          "Rosario","Roseau","Roskilde","Ross-on-Wye","Rostock",
          "Rostov-on-Don","Rottenburg","Rotterdam","Rottweil",
          "Roudnice nad Labem","Rouen","Rouffach","Rovereto",
          "Royal Leamington Spa","Royston","Rubtsovsk","Ruse",
          "Rushden","Russelsheim","Rutland","Ry","Ryazan","Rybinsk",
          "Rybnik","Rzeszow","Saarbrucken","Sabadell","Sackville",
          "Saint Denis","Saint Gallen","Saint Helens","Saint Paul",
          "Saint Petersburg","Saint-Denis","Saint-Etienne-du-Rouvray",
          "Saint-Hilaire-de-Riez","Saint-Jory","Saint-Laurent-de-la-Salanque",
          "Saint-Maur-des-Fosses","Saint-Ouen","Saint-Sulpice-la-Pointe",
          "Sainte-Foy-les-Lyon","Salatiga","Salem","Salem","Salford",
          "Salinas","Salt Lake City","Salta","Salvador","Salzburg",
          "Samara","Samarinda","Sammamish","Samsun","San Andres de Giles",
          "San Antonio","San Bernardino","San Diego","San Francisco",
          "San Gwann","San Jose","San Jose","San Luis Potosi",
          "San Miguel de Tucuman","San Pedro","San Salvador",
          "San Salvador de Jujuy","San Sebastian","San Sebastian de los Reyes",
          "Sana'a","Sandton","Sandy Springs","Sanford","Sankt Augustin",
          "Sankt Ingbert","Santa Cruz de Tenerife","Santa Cruz de la Sierra",
          "Santa Fe","Santander","Santarem","Santiago","Santiago",
          "Santo Andre","Santo Domingo","Santo Tirso","Santos",
          "Sao Bernardo do Campo","Sao Jose dos Campos","Sao Leopoldo",
          "Sao Luis","Sao Paulo","Sapporo","Sarajevo","Sarandi",
          "Saransk","Saratov","Saskatoon","Sayville","Schaffhausen",
          "Schiltigheim","Schio","Schloss Holte-Stukenbrock",
          "Schwabisch Gmund","Schwabisch Hall","Schwandorf","Schwelm",
          "Schwerte","Scotts Valley","Seattle","Seclin","Secunderabad",
          "Seixal","Semarang","Sendai","Seongnam-si","Seoul",
          "Sestri Levante","Setagaya","Sete Lagoas","Setif","Seville",
          "Sfantu Gheorghe","Shah Alam","Shanghai","Sharjah",
          "Shawnigan Lake","Sheffield","Shelton","Shenzhen","Sherbrooke",
          "Shimla","Shinjuku","Show Low","Shrewsbury","Shtip",
          "Sibiu","Sidi Bel Abbes","Siegen","Singapore","Sint-Jans-Molenbeek",
          "Sint-Truiden","Sintra","Sisteron","Skanderborg","Skopje",
          "Skovde","Slough","Smithfield","Smyrna","Sneek","Socastee",
          "Sochi","Soest","Sofia","Sola","Solingen","Solnechnogorsk",
          "Solon","Soma","Sombor","Sonderborg","Sondrio","Sopot",
          "Sopron","Sorocaba","Sosnowiec","South Brunswick Township",
          "South Jordan","South St. Paul","South Tangerang","Southampton",
          "Southport","Spalding","Spijkenisse","Spisska Nova Ves",
          "Split","Spokane Valley","Spring Hill","Springfield",
          "Springfield","Sremska Mitrovica","St. Louis","Stade",
          "Stafford","Stara Zagora","Starogard Gdanski","Staufen",
          "Stavanger","Steenwijk","Steinfurt","Sterling Heights",
          "Stevenage","Steyning","Stockholm","Stockport","Stockton-on-Tees",
          "Stralsund","Strasbourg","Stuttgart","Subang Jaya",
          "Subotica","Suez","Sulzbach","Sumare","Sun Prairie",
          "Sundsvall","Sunnyvale","Surabaya","Surat","Surgut",
          "Surrey","Suwanee","Suwon-si","Suzhou","Swakopmund",
          "Sydney","Szczecin","Szekesfehervar","Szombathely",
          "Tabriz","Taif","Tainan City","Takatsuki","Tallinn",
          "Tampere","Tangerang","Taoyuan City","Tapachula","Tapejara",
          "Targu Jiu","Targu Mures","Tarnow","Tartu","Tashkent",
          "Tata","Taubate","Taunton","Tbilisi","Tegelen","Tegucigalpa",
          "Tehran","Teixeira de Freitas","Tekirdag","Tel Aviv",
          "Temirtau","Temse","Tepic","Terrassa","Texarkana","Texcoco",
          "Thane","Thanjavur","The Hague","Therwil","Thessaloniki",
          "Thimphu","Thionville","Thiruvananthapuram","Thrissur",
          "Tianjin","Tigard","Tilburg","Timisoara","Tipton","Tirana",
          "Tlmace","Tolbert","Toledo","Tomilino","Toms River",
          "Tonsberg","Torcy","Toronto","Torrance","Torreglia",
          "Torreon","Torres Vedras","Torrevieja","Toulon","Toulouse",
          "Tours","Traunstein","Trebic","Trencin","Treviso","Trier",
          "Trinec","Trnava","Trollhattan","Trondheim","Trutnov",
          "Tsukuba","Tubingen","Tucson","Tunis","Turin","Turku",
          "Tuttlingen","Tuzla Canton","Tyumen","Uberaba","Uberlandia",
          "Udaipur","Udine","Ufa","Uherske Hradiste","Uiwang-si",
          "Ulan-Ude","Ullensaker","Ulm","Ulsan","Urmia","Ushuaia",
          "Utica","Utrecht","Uzhhorod","Vaasa","Vadodara","Valasske Mezirici",
          "Valbonne","Valence","Valencia","Valencia","Valenzuela City",
          "Valera","Valley Stream","Valparaiso","Vancouver","Vanderbijlpark",
          "Varese","Varna","Vaudreuil-Dorion","Vaxjo","Vefsn",
          "Velbert","Velden","Veliko Tarnovo","Velizy-Villacoublay",
          "Velke Mezirici","Vellore","Velsen","Ventspils","Versailles",
          "Veszprem","Vicenza","Vicosa","Vienna","Vigo","Vijayawada",
          "Vila Nova de Famalicao","Vila Nova de Gaia Municipality",
          "Villa Gesell","Villa Maria","Villach","Villanova d'Asti",
          "Villeurbanne","Vilnius","Virum","Visp","Vitebsk","Vladikavkaz",
          "Vladivostok","Vlasikha","Volgograd","Volos","Voronezh",
          "Vrchlabi","Vriezenveen","Vsevolozhsk","Vung Tau","Wakefield",
          "Waren","Warrington","Warsaw","Warwick","Washington",
          "Washington","Washington","Waterford","Watford","Waynesburg",
          "Wedel","Weert","Weinheim","Wellington","Wembley","Wernigerode",
          "Wervik","West Bromwich","West Covina","West Des Moines",
          "West Jordan","West Lafayette","West Palm Beach","Wetter",
          "Wettingen","Wetzikon","Wevelgem","Widnes","Wiefelstede",
          "Wiehl","Wiener Neustadt","Wierden","Wiesbaden","Wietmarschen",
          "Wigan","Wilkes-Barre","Wilkinsburg","Williams Lake",
          "Williamsville","Wilsonville","Winchester","Winchester",
          "Windeck","Windhoek","Windsor","Windsor","Winnipeg",
          "Winsen","Winsen an der Aller","Winston-Salem","Winterthur",
          "Wodzislaw Slaski","Woking","Wolomin","Wolsztyn","Woodside",
          "Worcester","Worms","Wroclaw","Wunstorf","Wurzburg",
          "Wyndham","Wyomissing","Xalapa","Xiamen","Yekaterinburg",
          "Yeosu-si","Yeovil","Yerevan","Yigitali","Yogyakarta",
          "Yokohama","Yongin-si","York","Zaandam","Zabrze","Zadar",
          "Zagazig","Zagreb","Zakopane","Zalaegerszeg","Zalec",
          "Zapopan","Zaporizhia","Zaragoza","Zaria","Zdunska Wola",
          "Zelenograd","Zheleznogorsk","Zhongli City","Zhukovsky",
          "Zielona Gora","Zilina","Zittau","Ziyang","Zlatoust",
          "Zlin","Zlotow","Zossen","Zurich","Zwolle"]; 

      var locationsSet = new Set(locationsArray1);
      console.log('Size of initial array of location names (with duplicates): ' + locationsArray1.length);    
      console.log('Size of initial set of location names: ' + locationsSet.size);   
      for (var i = 0; i < locationsArray2.length; i++)
        locationsSet.add(locationsArray2[i]);  
      console.log('New size of set of location names: ' + locationsSet.size);
    </script> 
  </body>
</html>

Output copied from Chrome console:

SetsLocationDemo.html:12 Size of initial array of location names (with duplicates): 1771
SetsLocationDemo.html:13 Size of initial set of location names: 1745
SetsLocationDemo.html:16 New size of set of location names: 2047

Programming - a skill for life!

How to apply your knowledge of Pascal when learning JavaScript