Code readability principles:

Names matter

// Bad
const d = 365;
const r = 0.08;

// Good
const DAYS_IN_YEAR = 365;
const INTEREST_RATE = 0.08;

Small functions

// Bad
function processUser(user) { /* 100 lines */ }

// Good
function validateUser(user) { /* 10 lines */ }
function saveUser(user) { /* 15 lines */ }
function notifyUser(user) { /* 8 lines */ }

Comments for why

// Bad
i++; // Increment i

// Good
i++; // Move to next page (pagination is 0-indexed)

The test: Can someone understand this in 6 months without asking you?