[{"data":1,"prerenderedAt":239},["ShallowReactive",2],{"term-l\u002Flocalstorage":3,"related-l\u002Flocalstorage":227},{"id":4,"title":5,"acronym":6,"body":7,"category":210,"description":211,"difficulty":212,"extension":213,"letter":214,"meta":215,"navigation":95,"path":216,"related":217,"seo":221,"sitemap":222,"stem":225,"subcategory":6,"__hash__":226},"terms\u002Fterms\u002Fl\u002Flocalstorage.md","LocalStorage",null,{"type":8,"value":9,"toc":204},"minimark",[10,15,19,23,26,30,193,197,200],[11,12,14],"h2",{"id":13},"eli5-the-vibe-check","ELI5 — The Vibe Check",[16,17,18],"p",{},"LocalStorage is a simple key-value storage built into every browser that persists even after you close the tab. It's like a tiny notebook your website can write in. Perfect for remembering user preferences, theme choice, or a small shopping cart. Just don't put passwords in there.",[11,20,22],{"id":21},"real-talk","Real Talk",[16,24,25],{},"LocalStorage is a Web Storage API that provides synchronous key-value storage in the browser with no expiration. Data persists across sessions and is scoped to the origin. Maximum size is ~5-10MB. Because it's synchronous and blocking, avoid large read\u002Fwrite operations that could cause jank.",[11,27,29],{"id":28},"show-me-the-code","Show Me The Code",[31,32,37],"pre",{"className":33,"code":34,"language":35,"meta":36,"style":36},"language-javascript shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","\u002F\u002F Save user preference\nlocalStorage.setItem('theme', 'dark')\n\n\u002F\u002F Read it back\nconst theme = localStorage.getItem('theme') \u002F\u002F 'dark'\n\n\u002F\u002F Remove it\nlocalStorage.removeItem('theme')\n\n\u002F\u002F Clear everything\nlocalStorage.clear()\n","javascript","",[38,39,40,49,90,97,103,138,143,149,169,174,180],"code",{"__ignoreMap":36},[41,42,45],"span",{"class":43,"line":44},"line",1,[41,46,48],{"class":47},"sHwdD","\u002F\u002F Save user preference\n",[41,50,52,56,60,64,67,70,74,76,79,82,85,87],{"class":43,"line":51},2,[41,53,55],{"class":54},"sTEyZ","localStorage",[41,57,59],{"class":58},"sMK4o",".",[41,61,63],{"class":62},"s2Zo4","setItem",[41,65,66],{"class":54},"(",[41,68,69],{"class":58},"'",[41,71,73],{"class":72},"sfazB","theme",[41,75,69],{"class":58},[41,77,78],{"class":58},",",[41,80,81],{"class":58}," '",[41,83,84],{"class":72},"dark",[41,86,69],{"class":58},[41,88,89],{"class":54},")\n",[41,91,93],{"class":43,"line":92},3,[41,94,96],{"emptyLinePlaceholder":95},true,"\n",[41,98,100],{"class":43,"line":99},4,[41,101,102],{"class":47},"\u002F\u002F Read it back\n",[41,104,106,110,113,116,119,121,124,126,128,130,132,135],{"class":43,"line":105},5,[41,107,109],{"class":108},"spNyl","const",[41,111,112],{"class":54}," theme ",[41,114,115],{"class":58},"=",[41,117,118],{"class":54}," localStorage",[41,120,59],{"class":58},[41,122,123],{"class":62},"getItem",[41,125,66],{"class":54},[41,127,69],{"class":58},[41,129,73],{"class":72},[41,131,69],{"class":58},[41,133,134],{"class":54},") ",[41,136,137],{"class":47},"\u002F\u002F 'dark'\n",[41,139,141],{"class":43,"line":140},6,[41,142,96],{"emptyLinePlaceholder":95},[41,144,146],{"class":43,"line":145},7,[41,147,148],{"class":47},"\u002F\u002F Remove it\n",[41,150,152,154,156,159,161,163,165,167],{"class":43,"line":151},8,[41,153,55],{"class":54},[41,155,59],{"class":58},[41,157,158],{"class":62},"removeItem",[41,160,66],{"class":54},[41,162,69],{"class":58},[41,164,73],{"class":72},[41,166,69],{"class":58},[41,168,89],{"class":54},[41,170,172],{"class":43,"line":171},9,[41,173,96],{"emptyLinePlaceholder":95},[41,175,177],{"class":43,"line":176},10,[41,178,179],{"class":47},"\u002F\u002F Clear everything\n",[41,181,183,185,187,190],{"class":43,"line":182},11,[41,184,55],{"class":54},[41,186,59],{"class":58},[41,188,189],{"class":62},"clear",[41,191,192],{"class":54},"()\n",[11,194,196],{"id":195},"when-youll-hear-this","When You'll Hear This",[16,198,199],{},"We store the selected language in localStorage.,LocalStorage is synchronous — don't write huge objects to it.,Clear localStorage in tests to avoid state bleed between test runs.",[201,202,203],"style",{},"html pre.shiki code .sHwdD, html code.shiki .sHwdD{--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#546E7A;--shiki-default-font-style:italic;--shiki-dark:#676E95;--shiki-dark-font-style:italic}html pre.shiki code .sTEyZ, html code.shiki .sTEyZ{--shiki-light:#90A4AE;--shiki-default:#EEFFFF;--shiki-dark:#BABED8}html pre.shiki code .sMK4o, html code.shiki .sMK4o{--shiki-light:#39ADB5;--shiki-default:#89DDFF;--shiki-dark:#89DDFF}html pre.shiki code .s2Zo4, html code.shiki .s2Zo4{--shiki-light:#6182B8;--shiki-default:#82AAFF;--shiki-dark:#82AAFF}html pre.shiki code .sfazB, html code.shiki .sfazB{--shiki-light:#91B859;--shiki-default:#C3E88D;--shiki-dark:#C3E88D}html pre.shiki code .spNyl, html code.shiki .spNyl{--shiki-light:#9C3EDA;--shiki-default:#C792EA;--shiki-dark:#C792EA}html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":36,"searchDepth":51,"depth":51,"links":205},[206,207,208,209],{"id":13,"depth":51,"text":14},{"id":21,"depth":51,"text":22},{"id":28,"depth":51,"text":29},{"id":195,"depth":51,"text":196},"frontend","LocalStorage is a simple key-value storage built into every browser that persists even after you close the tab.","beginner","md","l",{},"\u002Fterms\u002Fl\u002Flocalstorage",[218,219,220],"SessionStorage","Cookie","IndexedDB",{"title":5,"description":211},{"changefreq":223,"priority":224},"weekly",0.7,"terms\u002Fl\u002Flocalstorage","eVjeD7rqFc9ZjkYwFl4FHkWMOX1yGWKxT3-pd0OASAM",[228,232,236],{"title":219,"path":229,"acronym":6,"category":230,"difficulty":212,"description":231},"\u002Fterms\u002Fc\u002Fcookie","networking","A cookie is a tiny piece of data the server tells your browser to store and send back on every future request.",{"title":220,"path":233,"acronym":6,"category":210,"difficulty":234,"description":235},"\u002Fterms\u002Fi\u002Findexeddb","advanced","IndexedDB is a full-on database living inside your browser.",{"title":218,"path":237,"acronym":6,"category":210,"difficulty":212,"description":238},"\u002Fterms\u002Fs\u002Fsessionstorage","SessionStorage is just like LocalStorage except it forgets everything when you close the browser tab.",1776518292923]