Magic of Console 🧙🏻♀️
What mdn(Mozilla Developers Network) says 🧐
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.warnThe console.warn() method outputs a warning message to the Web console.
console.errorThe console.error() method writes an error message to the console.
console. infoThe 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.assertThe 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.groupThe 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.countWrites 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 🙌 .