Code Room
Code reviewMediumcr-g037
Subject Weak randomnessLevel Mid–Senior~20 minCommon in Algorithms & data structures interviewsIndustries Software development

Question

Review this Node.js password-reset token generator.

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.

Talk through your review
Code to reviewjs
function makeResetToken() {  let t = '';  const chars = 'abcdefghijklmnopqrstuvwxyz0123456789';  for (let i = 0; i < 8; i++) {    t += chars[Math.floor(Math.random() * chars.length)];  }  // store with 24h expiry  return t;}
Run or narrate your approach, then ask the coach.