Console
What mdn(Mozilla Developers Network) says ๐ง
: Logs information associated with a web page: network requests, JavaScript, CSS, security errors and warnings as well as error, warning and informational messages explicitly logged by JavaScript code running in the page context
What I say ๐
: console(object) is a bro/buddy of every js developer xd(life saver).
Let's dive into it ๐
You can open the console by (rightClick => inspect) on any of your web page.
<html>
<h1>Hello ,Console !</h1>
</html>
Magic begins from here ๐ฉ
I hope you know the most basic method of console object that is .log(console.log)
Let's jump into under-rated methods of console
console.warn
The console.warn() method outputs a warning message to the Web console.
console.warn('OH NOOO');
console.error
The console.error() method writes an error message to the console.
console.error('Shit!');
console. info
The console.info() method outputs an informational message to the Web console. In Firefox, a small "i" icon is displayed next to these items in the Web console's log.
console.info('Crocodiles eat 3-4 people per year');
console.assert
The console.assert(expression,message) method writes a message to the console, but only if an expression evaluates to false, message can be astring or object.
console.assert(document.getElementById("demo"), "You have no element with ID 'demo'");
console.group
The console.group() method indicates the start of a message group. All messages will from now on be written inside this group. Tip: Use the console.groupEnd() method to end the group. Tip: Use the console.groupCollapsed() method to hide the message group (collapsed by default).
console.count
Writes to the console the number of times that particular console.count() is called. You can add a label that will be included in the console view. By default the label "default" will be added.
That's it folks ,Shoot the like button if you found the blog useful ๐ .
ย