All about the console – Javascript

We can see an immediate result of our code on the console. Also, we can send errors, warnings, and info too.

Here is how to do that

To open the console on the browser open a new tab. After that, right-click to mouse and click on inspect element. You can do it using a keyboard. The shortcut for mac is command + shift + del, for windows ctrl + shift + del.

We can see the result using a log. code is – console.log(” Hello World”);

We can send error: console.error(" Its is an error");

To send warning code is – console.warn("This is a warning");

We can show object results using a table, console.table("person");

Also, you can set time on a particular code so that you can check how much time it takes to run the code.

The starting is console.time();

Your code here …

then the ending time console.timeEnd();

To clear console the code is : clear();

That all from me for the console.

Leave a Reply

Your email address will not be published. Required fields are marked *