JavaScript Variables Explained Clearly: Values, Types, and How Data Really Works
Day 02 of 40 Days of JavaScript is where JavaScript starts to feel real. Today’s focus is on variables, how values are stored, and why JavaScript behaves the way it does when data changes.
If variables are not clear, everything that follows—functions...
blog.greenroots.info5 min read
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.