Skip to content

Commit 91fd1d2

Browse files
feat: add comma operators
1 parent 9ab0352 commit 91fd1d2

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

part1 (Basics)/19_comma.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// Comma Operator in JavaScript
2+
3+
/*
4+
, Comma operator
5+
Evaluates multiple expressions and returns the value of the last one.
6+
*/
7+
8+
let x = (1, 2, 3);
9+
console.log(x); // Output: 3
10+
11+
let y;
12+
y = (console.log('First'), console.log('Second'), 42);
13+
console.log(y); // Output: 42

0 commit comments

Comments
 (0)