albertkao 12 Junior Poster in Training

To ensure my program keep the client preference after page refresh, do I do this:

var value = Cookie.get('key'); 
if (value == null) { 
    // get  the client preference 
    // ... 
    // save  the client preference 
    Cookie.set('key', 'uservalue'); 
} 

// use the client preference