File tree Expand file tree Collapse file tree 2 files changed +41
-11
lines changed Expand file tree Collapse file tree 2 files changed +41
-11
lines changed Original file line number Diff line number Diff line change 44 * functions provided by most of the web browsers.
55 *
66 * How to run this example:
7- * 1. node console.js
7+ * 1. node console-1 .js
88 * 2. See the message get displayed on prompt.
99 */
1010
1414*/
1515console . log ( "Hi, My name is Ashwin Hegde" ) ;
1616
17- var designation = "Web Developer " ;
17+ var designation = "Sr. Software Engineer " ;
1818console . log ( "I am " + designation + " at Cybage Software Private Limited, Pune, HQ" ) ;
1919
2020var experience = 2.6 ;
21- console . log ( "I have total %d of Experience" , experience ) ; // %d is for both Integer & Float.
21+ console . log ( "I have total %d of Experience, excluding 10 months as freelancer " , experience ) ; // %d is for both Integer & Float.
2222
2323var languages = {
2424 "lang1" : "JavaScript" ,
25- "lang2" : "PHP " ,
26- "lang3" : ".NET " ,
27- "lang4" : "Java " ,
25+ "lang2" : "Go " ,
26+ "lang3" : "PHP " ,
27+ "lang4" : "Python " ,
2828 "lang5" : "Ruby" ,
29- "lang6" : "Python "
30- }
29+ "lang6" : "Java "
30+ } ;
3131console . log ( "Printing output when used to print JSON Object via %s: " , languages ) ; // %s for String
3232console . log ( "Printing output when used to print JSON Object via %j: " , languages ) ; // %j for JSON
3333
3434console . log ( "%s is Awesome." , "node" ) ;
3535
3636/***
37- * Same as console.log
37+ * Same as console.log prints to stdout.
3838*/
3939console . info ( "Info: Information Message" ) ;
40- console . warn ( "Warn: Warning Message" ) ;
4140
4241/***
4342 * Same as console.log but prints to stderr.
4443*/
45- console . error ( "Error: Error Message" )
44+ console . error ( "Error: Error Message" ) ;
45+ console . warn ( "Warn: Warning Message" ) ;
4646
4747/***
4848 * console.time() will mark a time.
Original file line number Diff line number Diff line change 1+ /***
2+ * The goal of this file is to know about the console functions;
3+ * Used for printing standard outputs and errors. Similar to the console object
4+ * functions provided by most of the web browsers.
5+ *
6+ * How to run this example:
7+ * 1. node console-2.js 1>debug.log 2>errors.log [This will truncate the file to a length of zero]
8+ * OR 1. node console-2.js 1>>debug.log 2>>errors.log [This will append the messages]
9+ * 2. See the debug.log and errors.log generated files.
10+ */
11+
12+ /***
13+ * Prints to stdout.
14+ */
15+ console . log ( "Log" ) ;
16+
17+ /***
18+ * Same as console.log prints to stdout.
19+ */
20+ console . info ( "Info" ) ;
21+
22+ /***
23+ * Prints to stderr.
24+ */
25+ console . error ( "Error" ) ;
26+
27+ /***
28+ * Same as console.log prints to stderr.
29+ */
30+ console . warn ( "Warning" ) ;
You can’t perform that action at this time.
0 commit comments