Skip to content

Commit c82a3d6

Browse files
authored
Update how-to-use-the-nodejs-repl.md
Updated technical documentation to accurately describe console.log() as a function call expression (not merely a statement) and 5 === '5' as a comparison expression. Both are expressions in JavaScript, but differ in that console.log() produces side effects with an undefined return value, while comparison expressions directly return boolean results. Signed-off-by: rosald <35028438+rosald@users.noreply.github.com>
1 parent ef0aa81 commit c82a3d6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

apps/site/pages/en/learn/command-line/how-to-use-the-nodejs-repl.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ false
5959
>
6060
```
6161

62-
Note the difference in the outputs of the above two lines. The Node REPL printed `undefined` after executing `console.log()`, while on the other hand, it just printed the result of `5 === '5'`. You need to keep in mind that the former is just a statement in JavaScript, and the latter is an expression.
62+
Please note the difference in the outputs of the above two lines. The Node REPL printed undefined after executing console.log(), while it simply printed the result of 5 === '5'. Keep in mind that the former is a function call expression in JavaScript, and the latter is a comparison expression. Both are expressions, but console.log() primarily produces side effects (outputting content) and returns undefined, whereas the comparison expression directly returns a boolean result.
6363

6464
In some cases, the code you want to test might need multiple lines. For example, say you want to define a function that generates a random number, in the REPL session type in the following line and press enter:
6565

0 commit comments

Comments
 (0)