Skip to content

Commit 7d1e2d2

Browse files
committed
Fixed trailing comma for rest parameter
1 parent 60e957e commit 7d1e2d2

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10265,7 +10265,7 @@ console.log(numbers.includes(NaN)); // true
1026510265
#### 23. What is the output of below code
1026610266
1026710267
```javascript
10268-
let [a, ...b] = [1, 2, 3, 4, 5];
10268+
let [a, ...b, c] = [1, 2, 3, 4, 5];
1026910269
console.log(a, b);
1027010270
```
1027110271
@@ -10280,7 +10280,7 @@ console.log(a, b);
1028010280
##### Answer: 3
1028110281
1028210282
When using rest parameters, trailing commas are not allowed and will throw a SyntaxError.
10283-
If you remove the trailing comma then it displays 1st answer
10283+
If you remove the trailing comma and last element then it displays 1st answer
1028410284
1028510285
```javascript
1028610286
let [a, ...b] = [1, 2, 3, 4, 5];

0 commit comments

Comments
 (0)