showing results for - "array to dictionary javascript"
Emma
23 Aug 2017
1let data = [
2  {id: 1, country: 'Germany', population: 83623528},
3  {id: 2, country: 'Austria', population: 8975552},
4  {id: 3, country: 'Switzerland', population: 8616571}
5];
6
7let dictionary = Object.assign({}, ...data.map((x) => ({[x.id]: x.country})));
8// {1: "Germany", 2: "Austria", 3: "Switzerland"}
9
queries leading to this page
javascript list of dictionary to dictionaryjavascript turn array into dictionaryjavascript convert list to dictionaryarray as dictionary value avascriptdictionary to array javascriptjavascript convert dictionary of arrays to array of dictionariesjavascript make dictionary array from arrayjs dictionary to arrayhow to convert array to dictionary in jsconvert dictionary to array of dict javascriptconvert array to dictionary in javascriptjavascript array to python dictionaryjavascript convert array to dictionaryjs array to dictionary keysjavascript dictionary to arrayarray of dictionary jsjavasctipy convert array to dictionary of arrayhow to create a dict in array jsjavascript list to dictionaryjs convert dictionary to arrayhow to convert a dictionary to array javascriptdict to array jsjavascript array dictionaryjs array dictionaryconvert list to dictionary online javascriptconvert dict to array jsjavascript array dictionary with arrayarray of dictionary in javascriptjavascript dict to arrayconvert dict to array javascriptconvert dictionary to array in javascriptarray dictionary javascriptjs array to dictionaryjavascript array to dictionaryconvert dictionary to dict of array javascriptjs list to dictionaryjavascript turn dictionary key into arrayjavascript make dictionary from arrayjavascript single array to dictionaryhow to turn dictionary into array nodejsjavascript convert dict to arrayhow to convert an array to dictionary in jscreate a dict from array jscreate an array from dictionary javascriptturn array into dictionary javascriptconvert a dictionary to javascript arrayarray as dictionary key javascripthow to convert a dictionary to a list in javascriptjavascript map array to dictionarynode array to dictionaryconvert array to dictionary javascriptlist to dictionary javascriptdictionary to array jsconvert array to dictionary nodejsjavascript convert list to dictionary of keysconvert dictionary to array javascriptcreate dictionary from array javascripthow to turn javascript dictionary to listconvert dictionary to list in javascriptjavascript dictionary arrayjavascript array and dictionaryarray to dictionary javascriptjavascript create dictionary from arrayjs convert dict to arrayhow to convert dictionary to array in javascriptjavascript dictionary from arrayarray to dictionary javascript