Transcript from the "Debugging" Lesson
[00:01:21] So this can be a useful way for us to kind of assure ourselves of, let's say the fact that we're executing the body of a function if we log something when we start running that function body then we know that we got that far. And then we also have our console.warn and console.error if we want to kind of make it pop out a little bit more with those exclamation point, warning signs in the browser.
[00:01:47] And so we can do things like let's say log values, logs certain things within our code just to make sure to kind to check our understanding and to make sure that things are giving us the values that we expect. Sort of how in the console like as we've been working iteratively on our different functionality, we've been just checking things like, is an empty array truthy or falsey?
[00:02:12] Or did we get the right poodle standard string that we wanted out of this particular function? That sort of thing. So console log is a totally valid debugging technique that you can use, but sometimes you don't want your program really cluttered up with all kinds of console log statements.
[00:02:29] So often this will be a temporary thing that as a developer you're working through, you're developing locally, you're testing things out, you're maybe logging some things. You probably wanna remember to take them out at the end. And so sometimes that can mean that things get forgotten, things get left in there, you end up with a whole bunch of console output.
[00:02:45] And sometimes if you're loading a web page out there, and now that we're all using our developer tools and inspecting the page and looking at the console you might see stuff that's logging out from somebody else's code because they were just checking values and things like that. So that is one thing we can do to be debugging.