UMD Web Utilities Library
    Preparing search index...

    Function getLocalStorageInt

    • Retrieves an integer value from localStorage

      Gets a value from localStorage by key and parses it as an integer. Returns null if the key doesn't exist or the value cannot be parsed.

      Parameters

      • key: { key: string }

        The localStorage key to retrieve

      Returns number | null

      The parsed integer value, or null if not found

      const count = getLocalStorageInt({ key: 'visit-count' });
      if (count !== null) {
      console.log(`You've visited ${count} times`);
      }