Console outputs in Javascript.
Please remember that what you see here depends on your filter selection. It is available under Developer tools in chrome
The outputs will be visible according to your selections. Debug only shows on verbose.
I tried out the following console methods
1. console.log('This is a log');
4. console.info('This is an information');
6. let books = [
{ bookname: 'Recursion Sutras', subject: "Recursion" },
{ bookname: 'How to do Object Oriented Programming', subject: "OOPS" },
];
console.table(books);
7. let books = [
{ bookname: 'Recursion Sutras', subject: "Recursion" },
{ bookname: 'How to do Object Oriented Programming', subject: "OOPS" },
];
console.dir(books);
8. console.log('%c This is a great book, %c This is a greater book', 'font-size:40px;color:brown;background-color:green;', 'font-size:48px;color:green;background-color:brown;');
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Console</title>
<script>
function f() {//Function to print using the Console in Javascript
console.log('This is a log');
console.warn('This is a warning');
console.error('This is an error');
console.info('This is an information');
console.log("");
console.debug('This is a debug');
let books = [
{ bookname: 'Recursion Sutras', subject: "Recursion" },
{ bookname: 'How to do Object Oriented Programming', subject: "OOPS" },
];
console.table(books);
console.log("");
console.dir(books);
console.log('%c This is a great book, %c This is a greater book', 'font-size:40px;color:brown;background-color:green;', 'font-size:48px;color:green;background-color:brown;');
}
</script>
</head>
<body>
<script>
f();
</script>
</body>
</html>
0 Comments