Skip to content

Commit 4d4d004

Browse files
authored
Create Swap-Items.js
1 parent a1fa7c9 commit 4d4d004

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

Swap-Items.js

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
2+
// Swap Items
3+
4+
let a = 1;
5+
let b = 2;
6+
console.log(a); // output: 1
7+
console.log(b); // output: 2
8+
9+
[a, b] = [b, a];
10+
console.log(a); // output: 2
11+
console.log(b); // output: 1

0 commit comments

Comments
 (0)