File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -251,11 +251,12 @@ destructuring syntax. This has a few advantages:
251
251
252
252
1 . When someone looks at the function signature, it's immediately clear what
253
253
properties are being used.
254
- 2 . Destructuring also clones the specified primitive values of the argument
254
+ 2 . It can be used to simulate named parameters.
255
+ 3 . Destructuring also clones the specified primitive values of the argument
255
256
object passed into the function. This can help prevent side effects. Note:
256
257
objects and arrays that are destructured from the argument object are NOT
257
258
cloned.
258
- 3 . Linters can warn you about unused properties, which would be impossible
259
+ 4 . Linters can warn you about unused properties, which would be impossible
259
260
without destructuring.
260
261
261
262
** Bad:**
@@ -264,6 +265,9 @@ destructuring syntax. This has a few advantages:
264
265
function createMenu (title , body , buttonText , cancellable ) {
265
266
// ...
266
267
}
268
+
269
+ createMenu (" Foo" , " Bar" , " Baz" , true );
270
+
267
271
```
268
272
269
273
** Good:**
You can’t perform that action at this time.
0 commit comments