localstorage setitem then return value code example Example: set localstorage value localStorage.setItem("mytime", Date.now());