Search the Blog

Monday, August 12, 2019

JavaScript Printing to browser Console for debugging

A browser's debugging console can be used in order to print simple messages. This debugging or web console can be directly opened in the browser  and the log method of the console JavaScript object can be invoked by typing the following:

console.log('Programming Logic And Code');

Press Enter

Output- Programming Logic And Code

var obj = { test: 1 };
console.log(['string'], 1, obj, window);

Output-
console.log({ key1: 'val', key2: ['one', 'two'], key3: { a: 1, b: 2 } });
Output:
Object { key1: 'val', key2: Array[2], key3: Object }



console.log(new Date(0)); 
console.log(function test(a, b) { return c; });

Output-
Thu Jan 01 1970 05:30:00 GMT+0530 (India Standard Time)
VM53:1 ƒ test(a, b) { return c; }


Other print method to console-

1- console.info – small informative icon (ⓘ) appears on the left side of the printed string(s) or         object(s).
2- console.warn – small warning icon (!) appears on the left side. In some browsers, the                     background of the log is yellow.
3- console.error – small times icon (⊗) appears on the left side. In some browsers, the                       background of the log is red.
4- console.timeStamp – outputs the current time and a specified string, but is non-standard:
    console.timeStamp('msg');
    Output:
    00:00:00.001 msg
5- console.trace – outputs the current stack trace or displays the same output as the log method       if invoked in the global scope.








See Also
Palindrome JAVA Code- Programming Logic and Code with Syntax
JAVA Pattern Program Code with Pattern 6 Programming Logic and Code with Syntax
JAVA Pattern Program Code with Pattern 5 Programming Logic and Code with Syntax
JAVA Pattern Program Code with Pattern 4 Programming Logic and Code with Syntax
JAVA Pattern Program Code with Pattern 3 Programming Logic and Code with Syntax
JAVA Pattern Program Code with Pattern 2 Programming Logic and Code with Syntax
JAVA Pattern Program Code with Pattern Programming Logic and Code with Syntax
SQL Query for tracking the details of particular transaction in log table Programming Logic and Code with Syntax
SQL Query to track Invoice with multiple join full code Programming Logic and Code with Syntax
SQL Query to make GST Report HSN Code Wise Programming Logic and Code with Syntax
SQL Query for checking the mismatch of common data in two tables
SQL Query to track the details of any item
SQL SUM FUNCTION WITH QUERY AND SYNTAX
SQL AVG FUNCTION WITH QUERY AND SYNTAX
SQL COUNT FUNCTION WITH QUERY AND SYNTAX Programming Logic and Code with Syntax
SQL Order By with Query and Syntex Programming Logic and Code with Syntax
SQL NOT Operator with Syntax and Query Programming Logic and Code with Syntax
SQL OR Operator with Syntax and Query Programming Logic and Code with Syntax
SQL AND Operator with Syntax and Query
SQL Operators
SQL WHERE Clause syntax and Query
SQL Query Pending Purchase Order Details
SQL QUERY Pending dispatch instruction
SQL Query for Ledger Master Register
COMPLETE SQL QUERY FOR LEAVE REGISTER WITH UNION LEFT
SQL SELF JOINS WITH QUERY SYNTAX
SQL Full Joins WITH QUERY AND SYNTAX
SQL Right outer Joins WITH Query WITH SYNTAX
SQL Left Outer Joins with Query
SQL Inner Joins with query
SQL Joins syntax code and query
SQL QUERY Item Wise Final Purchase Details with joins and group by and left outer and order by clause
SQL Query for Item Master with group by and order by and joins
SQL Query to Get The List of All Employees with multiple tables
SQL Debtors Balance Details Query MIS with joins group
QUERY FOR Customer Ageing For Bank with round, convert, joins
SQL Query Creditors Balance Details with inner joins and group by
SQL Distinct keyword with multiple columns
SQL DISTINCT Keyword
Finds any values that start with alphabet and ends with alphabet
SQL Finds any values that start and end with "alphabet"
SQL Finds any values that end with "alphabet" and are at least 7 characters in length
SQL Finds any values that start with "alphabet" and are at least 3 characters in length
SQL Finds any values that start with "alphabet" and are at least 2 characters in length
SQL Search a alphabet or string in a column from end
SQL Search a alphabet or string in a column from Start
SQL Search a alphabet or string in a column with specific position from Start
SQL Like operator
SQL Delete Query
SQL Update Query
Insert Query in SQL Server
SQL Insert Query Without Index

No comments:

Post a Comment

Translate