Hi, I noticed two issues with the starter code in this exercise:
Function signature mismatch:
The problem statement says the function should accept “an arbitrary number of wagon IDs,” but the provided function getListOfWagons explicitly lists parameters (a, b, c, d, e, f, g, h, i, j, k, l, m, n).
To correctly support a variable number of arguments, the function should use the rest operator:
export function getListOfWagons(...ids) { ... }
Invalid JSDoc type:
The provided JSDoc uses @param {...numbers} ids, but numbers is not a valid JSDoc type. It should be @param {...number} ids or @param {number[]} ids.
Together these make the exercise confusing — especially since earlier tasks don’t mention the need to modify starter code or the JSDoc. Fixing these would make the instructions and code consistent and less misleading for learners.
Not a JS maintainer, but the first part about the function signature seems appropriate. Changing the function signature to use a rest parameter is surely part of the exercise so students are exposed to adding one.
For the second part, Use JSDoc suggests @param {...number} so the proposed change makes sense to me at least.
To practice, use the rest or spread operator to solve each of the tasks below.
If we changed the stub to no arguments we’d get the same complaint that it’s “confusing” and if we change it to ...ids, you miss the opportunity to learn.
The provided JSDoc uses @param {...numbers} ids , but numbers is not a valid JSDoc type. It should be @param {...number} ids or @param {number[]} ids .
You are correct. We’ll take a PR to change it to {...number} ids which is correct.
Hello! I just got started on this exercise and must confess I’m utterly confused how to get started. The input in the text does not match the input in the example code.
Ok, never mind. Got it. Apparently I was supposed to change the params of the examplefunction. Must say this was not clear to me. I vote for leaving this empty :-)