I am sorting my people
data and works fine
people.sort(
(a, b) =>
a.nickname.localeCompare(b.nickname) ||
a.name.localeCompare(b.name) ||
a.age - b.age
);
The problem is that some nickname
are empty string ''
and they go on top of the array, which I don't want
How can I sort them just by name
and age
when the nickname
is empty string? I am not able to use if statements