We are still cooking the magic in the way!
Problem
Code like "if (status === 3)" or "timeout = 86400" is meaningless to anyone reading it — including your future self.
Solution
Replace magic numbers with named constants. The name explains the purpose, and changing the value only requires one edit.
Benefit
Self-documenting code, fewer bugs when values change, and easier code reviews.
Code Example
// Bad — what does 3 mean? What is 86400?
if (order.status === 3) { ... }
setTimeout(cleanup, 86400000);
// Good — self-documenting
const STATUS_APPROVED = 3;
const ONE_DAY_MS = 24 * 60 * 60 * 1000;
if (order.status === STATUS_APPROVED) { ... }
setTimeout(cleanup, ONE_DAY_MS);