In step 3 of this tutorial there’s a part that I don’t understand at all and don’t really know how to search for information on it because I haven’t encountered it before.
const geoJson = {
type: ‘FeatureCollection’,
features: data.map((country = {}) => {
const { countryInfo = {} } = country;
const { lat, long: lng } = countryInfo;
return {
type: ‘Feature’,
properties: {
…country,
},
geometry: {
type: ‘Point’,
coordinates: [ lng, lat ]
}
}
})
}
Is this (country = {}) =>
just assigning country to an empty array if the country parameter is empty ?
And then this const = { countryInfo = {} } = country
is sort of doing the same thing? But why is it wrapped in brackets?
And the next line confuses me the most const { lat, long: lng } = countryInfo;
What terms should I use to find more info on this? I just need a starting point because I’m a bit lost.
Thanks in advance!