Don't understand the purpose of console.log

New to JS and im not sure what console.log does. i dont recall any lesson that has gone over it so far in FCC but they have it quite often in their code examples. Anyone have any video recommendations for a video or article that goes over this very basic (i have no background in coding, only did the first html and css part of FCC). Thanks in advance.

Hey, @ibnadam :wave:!

The console is a panel that displays important messages, like errors, for developers. Much of the work the computer does with our code is invisible to us by default. If we want to see things appear on our screen, we can print, or log , to our console directly.

In JavaScript, the console keyword refers to an object, a collection of data and actions, that we can use in our code. Keywords are words that are built into the JavaScript language, so the computer will recognize them and treats them specially.

One action, or method, that is built into the console object is the .log() method. When we write console.log() what we put inside the parentheses will get printed, or logged, to the console.

2 Likes

I remember having the same doubt, what the heck is the console.log() for?, everyone mentions it and I have no idea what is its purpose. It’s kinda hard to understand the importance of console.log() when you are first starting out, but in a nutshell the console.log() is used to print something to the console. If you want to see the output of your code then you print or log it in the console.

Given that you are new to programming, it’s probably going to be a bit hard at the beginning, so hang on there. Also I think you should learn from other resources as well and not only FCC, I mean FCC JavaScript curriculum is great but I don’t think it’s very beginner friendly.

Watch this crash course, it might help you clear some doubts: https://www.youtube.com/watch?v=qoSksQ4s_hg&index=1&list=PL4cUxeGkcC9i9Ae2D9Ee1RvylH38dKuET

If you can afford buying a course on Udemy I would strongly recommend you to purchase Mosh Hamedani JavaScript course, this guy is the best teacher I’ve ever had, I cannot recommend this guy enough.

https://www.udemy.com/javascript-basics-for-beginners/

Watch some of the free videos and see if it’s right for you.

2 Likes