Code Room
Vibe codingMediumvc-g385
Subject Ai code comprehensionLevel Mid–Senior~16 minCommon in Algorithms & data structures interviewsIndustries Software development

Question

You inherit a legacy billing utility and ask an AI agent to explain this JavaScript function. The agent confidently replies: "This computes the number of full billing days between two dates inclusive of both endpoints — so Jan 1 to Jan 3 returns 3." Before you build a proration feature on top of it, how do you check whether that explanation is actually true?

js
function billingDays(start, end) {  const ms = end.getTime() - start.getTime();  return Math.floor(ms / 86400000);}
What a strong answer looks like

Treat the AI’s output as a draft to verify, not an answer to trust. Name the specific flaw and the input that triggers it, say how you’d catch it — tests, edge cases, reading critically — and how you’d re-prompt or decompose to get it right.

Describe your solution

Vibe coding: describe the solution in plain language (or narrate it) and the coach grades your approach. Generating runnable code from your description is coming next.

Run or narrate your approach, then ask the coach.