how to return a value from localstorage in javascript code example Example: get localstorage value localStorage.getItem('bgcolor');