JS Elyses Destructured Enchantments exemplar inconsistent

In the JS mentoring exemplar of Elyses Destructured Enchantments, there are a few inconsistencies with the function parameters, here are some of them:

export function swapTopTwoCards([a, b, ...rest]) {
  return [b, a, ...rest];
}
export function discardTopCard(deck) {
  const [first, ...rest] = deck;

  return [first, rest];
}

In swapTopTwoCards, it uses the destructuring syntax in the parameter, but in discardTopCard, it does it inside the function.

Should I PR to change this?

Here’s also a screenshot:

1 Like

Sure. Your proposal is actually matching my solution.

That said, I don’t think destructuring in the parameter is necessarily better (more examplar), or that it must be consistent, but I am happy to accept a PR to enforce consistency here.

Here is the PR:

2 Likes