Code Room
Code reviewMedium
Question
Review this JavaScript that builds a price-count histogram and serializes it, expecting to read prices back later.
What a strong answer looks like
Separate real bugs from style. Rank issues by severity, point at the root cause rather than the symptom, and suggest a concrete fix — specific and kind.
Learn the concepts
function histogram(prices) { const h = {}; for (const p of prices) { // p like 0.1, 0.2, 0.3 const key = p * 3; // bucket width grouping h[key] = (h[key] || 0) + 1; } return JSON.stringify(h);}Run or narrate your approach, then ask the coach.