15
I finally learned what console.log() actually does after 6 months of guessing
So I've been coding little projects for a while, mostly following YouTube tutorials. I kept seeing people type console.log() and throwing random words in there, but I thought it was just some kind of decoration or comment thing. Last week I actually read a guide on freeCodeCamp that explained it prints stuff to the browser console for debugging, and I felt so dumb for not knowing sooner. Has anyone else had that moment where a simple tool clicks way later than it should?
2 comments
Log in to join the discussion
Log In2 Comments
cameron_craig18d ago
Dude same, I was putting console.log("hello") in my code for like 3 months thinking it was just a way to celebrate finishing a function or something. Then my buddy looked at my screen and was like "why do you keep yelling hello at your code?" and I had to look it up. Once it clicked that it actually shows you what your variables are doing, it was a total game changer for debugging. Now I spam it everywhere just to see what's happening.
5
ben_shah9317d ago
lol wait no. console.log() doesn't actually print to the browser console. It's not like a printer or anything. It logs to the developer console that's hidden behind F12 or right click inspect. That's the real click moment - you actually have to open that panel to see what it says. Took me way too long to figure that out too.
4