Top 7 Javascript Console Methods
Today, We will learn the Top 7 Javascript Console Methods in this tutorial I will give you examples of Top 7 Javascript Console Methods. JavaScript console method is a property containing a function definition. A Javascript Console method is an object used to access the browser debugging console. Javascript Console Methods to print messages, warnings, and errors to the browser console, which is helpful for debugging purposes.
Table of concept
Top 7 Javascript Console Methods
1. Log
Outputs a message to the console.
Example:
console.log("Top 7 Javascript Console Methods");
Output:
Top 7 Javascript Console Methods
2. Error
Outputs an error message to the console.
Example:
console.error("This is a error message");
Output:
3. Warn
Outputs a warning message to the console.
Example:
console.warn("This is a warning message");
Output:
4. Assert
Writes an error message to the console if an assertion is false.
Example:
console.assert(2 + 3 == 6, "Expression return false");
Output:
5. Table
Displays tabular data as a table.
Example:
console.table(["PHP", "Laravel", "WordPress"]);
Output:
6. Count
Logs the number of times that is particular call to count[] has been called.
Example:
for(let i = 1; i<=5; i++) {
console.count()
}
Output:
7. Clear
Clear the console.
Example:
console.clear();