Computer Basics 21 - Chrome JavaScript Console and how Logging works

The Console: A Powerful Tool for Debugging and Development in JavaScript

In this video, we're going to explore one of the most essential tools in JavaScript development: the console. Also known as the browser console, it's used to display system administrative messages and is a great tool for debugging and finding out where problems are occurring in your code.

The Console can be found in various browsers, including Chrome, which is what we'll be focusing on today. To access the console, you simply need to open your browser and look for the console tab, usually located at the bottom of the browser window. Once you've accessed the console, you'll see a variety of tools and options that can help you debug and troubleshoot your code.

One of the most important things to remember when working with the console is the `console.log` statement. This statement allows you to display text in the console, which can be useful for debugging purposes. The `log` part of the statement means "log it here," followed by some parentheses where you can write whatever you want. You can put this statement anywhere in your code and it will work just fine.

Another important concept to grasp is that the console can display various types of data, including strings, numbers, and Boolean values. For example, if you use `console.log` with a string inside quotes or single quotes, like "Free Code Camp Rocks" or 'Free Code Camp Rocks', the console will display the text exactly as it was written. On the other hand, if you try to log a word without quotes, like just the word "words", nothing will happen because the console doesn't recognize it as a string.

You can also use numbers and Boolean values with `console.log`. For instance, if you write `console.log 1,24`, the console will display the number exactly as written. Similarly, if you write `console.log true` or `console.log false`, the console will display "true" or "false", respectively. However, if you try to log a word like "words" again without quotes, nothing will happen.

Now that we've covered some basics of how to use the console, let's look at an example. Imagine you're writing code and you want to test whether something is working as expected. You can write a statement like `if this doesn't work console.log 'this is broken online 43'`, which will display a message in the console if your assumption is incorrect. Similarly, you can use statements like `console.log Briana` or `console.log true` to test whether certain values are being displayed correctly.

In conclusion, the console is an incredibly powerful tool that's essential for any JavaScript developer. By understanding how to use it effectively, you'll be able to debug and troubleshoot your code with ease, making you a more efficient and effective developer.

"WEBVTTKind: captionsLanguage: enhi in this video we are going to be talking about the console what it is where you can find it and what you use it for now the console is very commonly used to display system administrative messages your browser has a console your computer has a console once you become more familiar with it you'll find it to be a really powerful and effective tool in JavaScript the console is used as a great tool for debugging and finding out where in your code there's a problem one of the most important words you're going to need to remember is console.log now console is the thing that shows the text. log means log it here write it here then there's some parentheses and you can write whatever you want uh now the process of doing this can be put anywhere in the lines of code just like in the last video we go down sequentially you can put some kind of statements that say you know if this doesn't work console laog this is broken online 43 or whatever you need to do to help yourself figure out what the problem is and where it's happening all right what you see here is the Chrome browser with the Chrome console the console can also be up on the side but we're going to keep it down below for now you are probably also seeing this console.log we are going to console log a string a string is inside quotes or single quotes like this uh let's console free code Camp Rocks now if we run this code right here now here it's false that's what it's returning to this but down here in the console you see free code Camp Rocks awesome right now we can also console a number like 1,24 and there it is and we can also console a Boolean which is a true or false statement do console log true and it's going to say true if we try and say a word like uh words and console log that it's nothing's going to happen that doesn't recognize words because it doesn't know if it's a string or what but once you put it inside of some of these guys then it knows what we're talking about you can also combine things so say I want to say console log uh Briana is and then true we'll see what happens there we get Brian is true you can see the color differentiation here if your screen's big enough uh if not it just says is and then true is in blue because that's a Boolean as opposed to the string uh you can use this in a bunch of different ways but this is what console really looks likehi in this video we are going to be talking about the console what it is where you can find it and what you use it for now the console is very commonly used to display system administrative messages your browser has a console your computer has a console once you become more familiar with it you'll find it to be a really powerful and effective tool in JavaScript the console is used as a great tool for debugging and finding out where in your code there's a problem one of the most important words you're going to need to remember is console.log now console is the thing that shows the text. log means log it here write it here then there's some parentheses and you can write whatever you want uh now the process of doing this can be put anywhere in the lines of code just like in the last video we go down sequentially you can put some kind of statements that say you know if this doesn't work console laog this is broken online 43 or whatever you need to do to help yourself figure out what the problem is and where it's happening all right what you see here is the Chrome browser with the Chrome console the console can also be up on the side but we're going to keep it down below for now you are probably also seeing this console.log we are going to console log a string a string is inside quotes or single quotes like this uh let's console free code Camp Rocks now if we run this code right here now here it's false that's what it's returning to this but down here in the console you see free code Camp Rocks awesome right now we can also console a number like 1,24 and there it is and we can also console a Boolean which is a true or false statement do console log true and it's going to say true if we try and say a word like uh words and console log that it's nothing's going to happen that doesn't recognize words because it doesn't know if it's a string or what but once you put it inside of some of these guys then it knows what we're talking about you can also combine things so say I want to say console log uh Briana is and then true we'll see what happens there we get Brian is true you can see the color differentiation here if your screen's big enough uh if not it just says is and then true is in blue because that's a Boolean as opposed to the string uh you can use this in a bunch of different ways but this is what console really looks like\n"