๐Ÿ—„๏ธ localStorage Demo

Interactive demonstration of browser localStorage API methods
Note: This demo uses the prefix "lsdemo_" to keep its data separate from other apps on this domain

๐Ÿ“Š Storage Statistics

Total Items
0
Estimated Size
0 KB

โž• setItem(key, value)

setItem() stores a key-value pair in localStorage. Both key and value must be strings.

๐Ÿ” getItem(key)

getItem() retrieves the value associated with a key. Returns null if the key doesn't exist.

๐Ÿ—‘๏ธ removeItem(key)

removeItem() deletes a specific key-value pair from localStorage.

๐Ÿ”‘ key(index)

key() returns the key name at a specific index position. Useful for iterating through all items.

๐Ÿงน clear()

clear() removes all key-value pairs from localStorage. Use with caution!

๐Ÿ’พ Current localStorage Contents

No items in localStorage

๐Ÿ“ฆ Storing Complex Data (JSON)

localStorage only stores strings. To store objects/arrays, use JSON.stringify() when setting and JSON.parse() when getting.