code: function hasLocalStorage() {
    if (!localstorage) {
      return false;
    }
  
    try {
      localstorage.setItem('0', '');
      localstorage.removeItem('0');
      return true;
    } catch (error) {
      return false;
    }
  }
docs: Check if the browser has localStorage
  @return {Boolean}