I have array of following class
export class Tests {
id: number;
name: string;
createdAt: any;
succress: boolean;
constructor(id: number, name: string, createdAt: any, success: boolean) {
this.id = id;
this.name = name;
this.createdAt = createdAt;
this.succress = success;
}
}
And I want to sort it by value of success (false on top and true on bottom). How can I do that?
I've tried
this.tests.sort((a,b)=> b.succress - a.succress);
But is not doing anything