function setLocalStorageItem(key, value) {
  window.localStorage.setItem(key,
    JSON.stringify(value)
  );
}
function setLocalStorageItem(key, value) {
  window.localStorage.setItem(key,
    JSON.stringify(value)
  );
}
function setLocalStorageItem ( key , value ) { window . localStorage . setItem ( key , JSON . stringify ( value ) ) ; }
Set a value of any type in localStorage.
(Serializes in JSON before storing since Storage objects can only hold strings.)

@param {String} key   Key in localStorage
@param {*}      value The value to set
Set a value of any type in localStorage . ( Serializes in JSON before storing since Storage objects can only hold strings . )