Skip to content

Commit 2c72ba2

Browse files
feat: update printing file
update the code for better understanding
1 parent ecdf309 commit 2c72ba2

File tree

1 file changed

+7
-14
lines changed

1 file changed

+7
-14
lines changed

part1 (Basics)/05_printing.js

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,22 @@
1-
// printing.js
2-
31
// INFO: Different Ways to Print Output in JavaScript
42

5-
// 1. console.log()
6-
// - Prints messages to the console with a newline.
3+
// 1. console.log() - Prints messages to the console with a newline.
74
console.log("Hello");
85

9-
// 2. process.stdout.write()
10-
// - Writes output without adding a newline (Node.js specific).
6+
// 2. process.stdout.write() - Writes output without adding a newline (Node.js specific).
117
process.stdout.write("hey\n"); // Added \n for newline
128

13-
// 3. console.table()
14-
// - Displays objects or arrays in a table format for better readability.
9+
// 3. console.table() - Displays objects or arrays in a table format for better readability.
1510
console.table({ city: "Islamabad" });
1611

17-
// 4. console.warn()
18-
// - Prints warning messages, usually highlighted in the console.
12+
// 4. console.warn() - Prints warning messages, usually highlighted in the console.
1913
console.warn({ city: "newCity" });
2014

21-
// 5. console.error()
22-
// - Prints error messages, usually highlighted in the console
15+
// 5. console.error() - Prints error messages, usually highlighted in the console
2316
console.error("The error message");
2417

2518
/*
2619
Note:
27-
- In browsers, `console.log()`, `console.warn()`, and `console.table()` are commonly used.
28-
- `process.stdout.write()` is primarily used in Node.js environments.
20+
- In browsers, console.log(), console.warn(), and console.table() are commonly used.
21+
- process.stdout.write() is primarily used in Node.js environments.
2922
*/

0 commit comments

Comments
 (0)