[{"data":1,"prerenderedAt":180},["ShallowReactive",2],{"term-m\u002Fmagic-number":3,"related-m\u002Fmagic-number":169},{"id":4,"title":5,"acronym":6,"body":7,"category":152,"description":153,"difficulty":154,"extension":155,"letter":156,"meta":157,"navigation":93,"path":158,"related":159,"seo":163,"sitemap":164,"stem":167,"subcategory":6,"__hash__":168},"terms\u002Fterms\u002Fm\u002Fmagic-number.md","Magic Number",null,{"type":8,"value":9,"toc":146},"minimark",[10,15,28,32,35,39,135,139,142],[11,12,14],"h2",{"id":13},"eli5-the-vibe-check","ELI5 — The Vibe Check",[16,17,18,19,23,24,27],"p",{},"A random number in your code with no explanation. Like writing ",[20,21,22],"code",{},"if (age > 17)"," instead of ",[20,25,26],{},"if (age > MINIMUM_AGE)",". Nobody knows why it's 17, where it came from, or what it means. Always use named constants instead!",[11,29,31],{"id":30},"real-talk","Real Talk",[16,33,34],{},"A magic number is a numeric literal in code that has no obvious meaning. It's considered an anti-pattern because it reduces readability and makes maintenance harder. The fix is to extract it into a named constant.",[11,36,38],{"id":37},"show-me-the-code","Show Me The Code",[40,41,46],"pre",{"className":42,"code":43,"language":44,"meta":45,"style":45},"language-javascript shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","\u002F\u002F Bad - magic number:\nif (retries > 3) { ... }\n\n\u002F\u002F Good - named constant:\nconst MAX_RETRIES = 3\nif (retries > MAX_RETRIES) { ... }\n","javascript","",[20,47,48,57,88,95,101,117],{"__ignoreMap":45},[49,50,53],"span",{"class":51,"line":52},"line",1,[49,54,56],{"class":55},"sHwdD","\u002F\u002F Bad - magic number:\n",[49,58,60,64,68,72,76,79,82,85],{"class":51,"line":59},2,[49,61,63],{"class":62},"s7zQu","if",[49,65,67],{"class":66},"sTEyZ"," (retries ",[49,69,71],{"class":70},"sMK4o",">",[49,73,75],{"class":74},"sbssI"," 3",[49,77,78],{"class":66},") ",[49,80,81],{"class":70},"{",[49,83,84],{"class":70}," ...",[49,86,87],{"class":70}," }\n",[49,89,91],{"class":51,"line":90},3,[49,92,94],{"emptyLinePlaceholder":93},true,"\n",[49,96,98],{"class":51,"line":97},4,[49,99,100],{"class":55},"\u002F\u002F Good - named constant:\n",[49,102,104,108,111,114],{"class":51,"line":103},5,[49,105,107],{"class":106},"spNyl","const",[49,109,110],{"class":66}," MAX_RETRIES ",[49,112,113],{"class":70},"=",[49,115,116],{"class":74}," 3\n",[49,118,120,122,124,126,129,131,133],{"class":51,"line":119},6,[49,121,63],{"class":62},[49,123,67],{"class":66},[49,125,71],{"class":70},[49,127,128],{"class":66}," MAX_RETRIES) ",[49,130,81],{"class":70},[49,132,84],{"class":70},[49,134,87],{"class":70},[11,136,138],{"id":137},"when-youll-hear-this","When You'll Hear This",[16,140,141],{},"\"What does the 86400 mean? That's a magic number — use SECONDS_IN_DAY instead.\"",[143,144,145],"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 .s7zQu, html code.shiki .s7zQu{--shiki-light:#39ADB5;--shiki-light-font-style:italic;--shiki-default:#89DDFF;--shiki-default-font-style:italic;--shiki-dark:#89DDFF;--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 .sbssI, html code.shiki .sbssI{--shiki-light:#F76D47;--shiki-default:#F78C6C;--shiki-dark:#F78C6C}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":45,"searchDepth":59,"depth":59,"links":147},[148,149,150,151],{"id":13,"depth":59,"text":14},{"id":30,"depth":59,"text":31},{"id":37,"depth":59,"text":38},{"id":137,"depth":59,"text":138},"general","A random number in your code with no explanation. Like writing `if (age > 17)` instead of `if (age > MINIMUM_AGE)`.","beginner","md","m",{},"\u002Fterms\u002Fm\u002Fmagic-number",[160,161,162],"Constant","Code Smell","Refactoring",{"title":5,"description":153},{"changefreq":165,"priority":166},"weekly",0.7,"terms\u002Fm\u002Fmagic-number","ihI_00knaYEZfRtA84sSHVihbA-XO9Fbqzy-lSgJokU",[170,174,177],{"title":161,"path":171,"acronym":6,"category":172,"difficulty":154,"description":173},"\u002Fterms\u002Fc\u002Fcode-smell","architecture","Code that works but feels... wrong. Like when food smells slightly off — it might be fine, but something isn't right.",{"title":160,"path":175,"acronym":6,"category":152,"difficulty":154,"description":176},"\u002Fterms\u002Fc\u002Fconstant","A constant is a box you seal shut after putting something in. You can look inside any time you want, but you can't swap out what's in there.",{"title":162,"path":178,"acronym":6,"category":172,"difficulty":154,"description":179},"\u002Fterms\u002Fr\u002Frefactoring","Refactoring is improving the internal structure of code WITHOUT changing what it does from the outside.",1776518294152]