Closed hrohilla2k4 closed 6 months ago
Yes, It is confusing and not clear.
I (think) the point is that the { title, body, buttonText, cancellable } object are all related to each other and are the basic non optional items. It would be strange to have a body text without a title text.
Those item might be coming for a common place, and generally based around together. You could destructure them and pass then in separately but then it would be easier to make a mistake. So having a item object is useful. And passing them in as one make sense.
hope this helps
Yes - I got it, thankyou @iirving.
Author asked to have only two or fewer parameters ideally. Bad function createMenu(title, body, buttonText, cancellable) { // ... }
Good function createMenu({ title, body, buttonText, cancellable }) { // ... }
createMenu({ title: "Foo", body: "Bar", buttonText: "Baz", cancellable: true });
What is the difference? Can anyone help me!.