Console.log


#1

What is the use of console.log exactly.? It just prints anything written in the parenthesis.
What if i exclude console.log() and just use the numbers and strings in place.


#2

console.log() prints anything you put between the parenthesis to the console.

Examples:

console.log("Hello World!");

Will print the string "Hello World!" to the log, which is seen to the right.
You can print more that strings (like numbers and etc.), but you will learn that along the way.

If you put nothing between the parenthesis it will print an empty line.

I hope this helps!


#3

Hi

I want to ask that if i write "Hello World!" even without console.log then also it prints on the right.
the same is with addition and multiplication

Then exactly what is the difference.


#4

console.log will output stuff to your screen which is called logging to the console. It has several uses including logging variables to the screen, logging math problems to the screen (blah, for some reason I want to say string instead of screen :slight_smile: ) logging strings to the screen which (strings are just sentences surrounded by quotation marks) and it has several other uses as well which I'm not going to get into right now for two reasons: one, I'm tired and need to take a shower :slight_smile: and two I'm to lazy to do research right now :slight_smile:


#5

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.