---
title: "Comment by max on \"JavaScript Variables Explained Clearly: Values, Types, and How Data Really Works\" | Hashnode"
description: "Really appreciate how you broke down the difference between primitive and reference types — that 'copying a reference vs copying a value' distinction trips up s"
url: "https://hashnode.com/posts/javascript-variables-explained-values-references/697a04549209c33467e84027/comment/69ad0753536b8710ef17d3d5"
---

[Discussion](https://hashnode.com/posts/javascript-variables-explained-values-references/697a04549209c33467e84027)

Comment [JavaScript Variables Explained Clearly: Values, Types, and How Data Really Works](https://hashnode.com/posts/javascript-variables-explained-values-references/697a04549209c33467e84027)

[max](https://hashnode.com/@maxxmini)

[Mar 8](https://hashnode.com/posts/javascript-variables-explained-values-references/697a04549209c33467e84027/comment/69ad0753536b8710ef17d3d5)

Really appreciate how you broke down the difference between primitive and reference types — that 'copying a reference vs copying a value' distinction trips up so many developers.

I've been building a financial tracking app (IndexedDB-based, runs entirely in the browser) and ran into a subtle bug where I was mutating an object I thought I'd cloned. Turned out I was just copying the reference. A simple `structuredClone()` fixed it, but it cost me hours of debugging.

Question: when you're teaching this concept, do you find students grasp it better with memory diagrams (boxes and arrows) or through live mutation examples in the console? Curious because I've seen both approaches and wonder which sticks better.
