“What is Console.log”

Hortencia Cisneros
2 min readSep 17, 2020

--

and how do we use it?

Lets first define what it is , as I understand it .
Console. log is a function in JavaScript which is used to print any kind of variables defined before or to just print any message that needs to be displayed to the user .

Syntax

console.log(message)
Parameter Values : “Message”
Type: “String or object”
Description:
The message or object to be displayed in the console”
some examples below

In this example
let myArr = [“Orange”, “Banana”, “Mango”, “Kiwi” ];
console.log(myArr);

Example: In the first example am assigning a variable →“learning to = parameter → (“Flatiron School) lets call this the Identifier“ calling my “string” → (“learning”) to the console which will “out put” my message → “Flatiron School”

Console.log is so much more than what I thought , did you know you can create a table ? I wish I had know this , as shown in the example above?
I create an array , I then console.log that array you can get more complex in your tables but for this example , I will just be showing you a much more simple table. As mentioned you can also get more complex tables using functions to help you and console.logging that .
Another cool thing about the console .log is that it will work whether you close it or not (); or () as in the first example , for this blog I ran all my tests for on repl.it, which I think is a wonderful resource .

I also discovered it has many other methods?
here are some examples of those methods and how they work .
. info
. error
.warn

for some clarity between console.log and return

return - returns execution to the caller with optional result

console.log() - logs out information in console. “it does not evaluates your code” it simply prints out what you put between the parentheses .

resources
https://developer.mozilla.org/en-US/docs/Web/API/console

.

--

--

Hortencia Cisneros

Coding my way into a new career and writing about it here