how to use variables with localStorage.getItem() code example Example: get localstorage value localStorage.getItem('bgcolor');