-1
Shoutout to the guy at the Austin library who showed me how to debug with console.table()
I was stuck on a messy data array for 2 hours and he walked over, typed console.table() in my console, and everything made sense instantly. Has anyone else had a random stranger save your coding session like that?
2 comments
Log in to join the discussion
Log In2 Comments
charles_henderson3d ago
Wait, console.table() is actually for arrays of objects, not just any messy data array. If you had a flat array it wouldn't have looked as pretty. Still a solid trick though, that guy saved your butt.
1
oscarm243d ago
Honestly, I had a boss once who was just staring at this giant messy array of numbers in the console and had no clue what was wrong. Tbh, I just did console.table() on it without even thinking, and it instantly made the data readable as a grid. Ngl, it felt like a superpower in that moment because we spotted the missing value right away. So yeah, even if the flat array wouldn't look as pretty, it's still way better than a wall of text. That trick has saved me more times than I can count, especially when debugging API responses.
3