Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* functions provided by most of the web browsers.
*
* How to run this example:
* 1. node console.js
* 1. node console-1.js
* 2. See the message get displayed on prompt.
*/

Expand All @@ -14,35 +14,35 @@
*/
console.log("Hi, My name is Ashwin Hegde");

var designation = "Web Developer";
var designation = "Sr. Software Engineer";
console.log("I am " + designation + " at Cybage Software Private Limited, Pune, HQ");

var experience = 2.6;
console.log("I have total %d of Experience", experience); // %d is for both Integer & Float.
console.log("I have total %d of Experience, excluding 10 months as freelancer", experience); // %d is for both Integer & Float.

var languages = {
"lang1": "JavaScript",
"lang2": "PHP",
"lang3": ".NET",
"lang4": "Java",
"lang2": "Go",
"lang3": "PHP",
"lang4": "Python",
"lang5": "Ruby",
"lang6": "Python"
}
"lang6": "Java"
};
console.log("Printing output when used to print JSON Object via %s: ", languages); // %s for String
console.log("Printing output when used to print JSON Object via %j: ", languages); // %j for JSON

console.log("%s is Awesome.", "node");

/***
* Same as console.log
* Same as console.log prints to stdout.
*/
console.info("Info: Information Message");
console.warn("Warn: Warning Message");

/***
* Same as console.log but prints to stderr.
*/
console.error("Error: Error Message")
console.error("Error: Error Message");
console.warn("Warn: Warning Message");

/***
* console.time() will mark a time.
Expand Down
30 changes: 30 additions & 0 deletions Kit/Session-3/Console/console-2.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/***
* The goal of this file is to know about the console functions;
* Used for printing standard outputs and errors. Similar to the console object
* functions provided by most of the web browsers.
*
* How to run this example:
* 1. node console-2.js 1>debug.log 2>errors.log [This will truncate the file to a length of zero]
* OR 1. node console-2.js 1>>debug.log 2>>errors.log [This will append the messages]
* 2. See the debug.log and errors.log generated files.
*/

/***
* Prints to stdout.
*/
console.log("Log");

/***
* Same as console.log prints to stdout.
*/
console.info("Info");

/***
* Prints to stderr.
*/
console.error("Error");

/***
* Same as console.log prints to stderr.
*/
console.warn("Warning");