Closed aleksanderwalczuk closed 4 years ago
If you keep highscores in the localstorage then load them into array, add the new highscore to that array, sort and put it back in the localstorage. Then clear the list on a screen and render it from scratch :) Should be good enough ;)
Thank you so much!
Works like a charm, thanks for your attention.
19
I've got some trouble with highscores. Now let me show you an example: this is an actual highscore list
// now I want to add another name with score, but let's say that we keep up to 3 highest scores and the score I want to add is the highest
this is a new list
// Tom is gone, but the rest has dropped one place below (John is 2, etc...)
It gets even more complex when we have ten scores and put a new one in the middle of the list (all below drop, but higher stays on the same place)
Any ideas? I already have a few, but for sure they're complex, unoptimised and the performance is a horror :)
@aszablowski , @miklosz , @michal-kusnierz , @cytrowski , @martyna-michno , @krichert
Originally posted by @Rednaxela700 in https://github.com/infoshareacademy/jfdd13-dreamteam/pull/19#issuecomment-566006522