sort an array by top 5
I have created an object Playlist with an array of songs, I need a method that returns an array with songs only from the five top artists, I honestly have tried different approaches with no success at all, I am not looking for the code, I am just looking for a hint so I can try something different. Thanks
this is the constructor of my class:
'''function Playlist(name){
this.name = name;
this.songs = new Array();
this.shuffled = false;'''
}
function Song(title, artist, duration, score){
this.title = title;
this.artist = artist;
this.duration = duration;
this.score = score;
this.currentSongIndex = 0;
}