.Localecompare Número FUNC

return [...this.posts].sort((post1, post2) => String(post1[this.selectedSort])?.localeCompare(String(post2[this.selectedSort])));
Joyous Jay