I have an array that contains objects, each object has these properties:
{ country: 'United States' },
{ country: 'Netherlands' },
{ country: 'Spain' },
{ country: 'Spain' },
I want to sort the array so that the first values will be the ones with 'Spain' then show all the others. I tried with array.sort but it seems not to work. Not sure what I am doing wrong.
So far I tried with this
arr.sort(function(a, b) {return a.country === 'Spain'})
also
arr.sort(function(a, b) {if (a.country === 'Spain') {return 1}})