There are a number of ways to store data client side, but in this post I will be mainly writing about the Web Storage API, rather than index db, cookies files, and many other options for client side persistence of data. The Web Storage API is easy to use as everything can just simply be stored as key value pairs of the localSorage global on clients that support the Web Storage API. However depending on the nature of the project it might not always be the best choice. Cookie files will always give better backward compatibility when it comes to older browsers, and the indexed db option is a better choice when it comes to storage large amounts of data. Still the Web Storage API is a good option for quickly getting the job done, and most modern browsers support the standard well.
So then here I have a basic example of the Web Storage API that just stores a single message that can be set in an test input element. I set some event handlers that will fire each time a keyboard key is released, or the value changes. Each time one of the events fire a set method will set the current value of the text input element to a mess property of the localStorage global. Each time the page loads a get method will fire that will set the value of the text element to the mess property of the localStorage global.