akshat-jn-crypto / Wordle-clone

Hackoberfest repo
https://Wordle-clone.akshatjain80.repl.co
MIT License
12 stars 25 forks source link

Added leaderboard functionality #20

Closed nalin243 closed 1 year ago

nalin243 commented 1 year ago

alertbox

leaderboard

The leader board is done.

akshat-jn-crypto commented 1 year ago

Explain your code

nalin243 commented 1 year ago

First of all I divided the page into two parts left and right and put the leader board table on the left. As for the js section, every time a user reloads the page they are asked for their username. When they win, the code checks whether this user object is in the sessionStorage or not. If it's present then it simply updates the score in the storage and then displays the storage in the form of leader board or it first adds the new user and then displays the leader board.

updateStorage() updates the sessionStorage updateLeaderBoard() basically displays the leaderboard array