Function arguments (2 or fewer ideally) - Talks about destructing but I don't see destructing used
bluEEil opened this issue · comments
Ziv Glazer commented
In the example of "Function arguments (2 or fewer ideally)"
There is a talk about destrcuting, which to what I know is:
const object = {a: 1, b: 2};
const {a, b} = object; // This is destrcuting
Now what the code there does is
function createMenu(options: { title: string, body: string, buttonText: string, cancellable: boolean }) {
// ...
}
createMenu({
title: 'Foo',
body: 'Bar',
buttonText: 'Baz',
cancellable: true
});
I can't find the destructing here (I don't think declaring option type should be considered as destructing.
In the "Set default objects with Object.assign or destructuring" the last example actually does use destructing unlike in this example.
Maybe the paragraph of "Function arguments" should be changed? Or am I missing something here?