10
The trick that FINALLY made arrays click for me in JavaScript
I've been learning JavaScript on and off for about 3 months now, and arrays were KILLING me. I couldn't figure out why my code would just break when I tried to loop through them or grab specific items. I watched like 5 YouTube tutorials and read through MDN docs but nothing stuck. Then last week I tried using console.table() instead of console.log() to see what was actually in my arrays and it was like a lightbulb went off. Seeing the data laid out in a proper table format helped me understand indices and nested arrays way better. I also started naming my arrays with plural words like 'users' instead of 'userData' which made the code read more naturally. Has anyone else had that moment where a tiny debugging tool completely changed how you understood something?
2 comments
Log in to join the discussion
Log In2 Comments
morgan9151mo ago
Honestly I gotta disagree hard here! Using console.table is just adding another layer between you and actually understanding how arrays work in code.
4
derek_brown281mo ago
console.table is just a crutch for beginners to be honest... you learn way more by logging things out raw and seeing the structure yourself. Forces you to actually get comfortable with bracket notation and loops instead of just looking at a pretty grid.
7