I wrote a game (will be played on a server) and I want to store the high scores from the players. The stored scores should be available and accessible all the time for all the players.
What would a good approach towards this (I would prefer vanilla.js) is possible?
Well you will need a server or a service to do this. Since creating your own server requires an actual machine and a lot of work and maintenance, a service might better suit your needs.
The best service I have found, that is free with limited bandwidth, is Firebase. It is a database as a service, and you can use it to store things just like you would locally in a local or session storage. If your game becomes huge and uses a lot of bandwidth, you'll need to start paying, but maintaining a server is not free either.