I've just spent quite a bit of time on problem 5 because there is no information in the instructions (or on the web for that matter) about how to do a destructured assignment into an object.
If you google ES6 destructuring, all the examples show assignments to simple variables rather than object properties.
The given solution achieves this using
[, result.username, result.email] = args;
which works, but can be the source of many frustrations because it gives an unhelpful syntax error if preceded with the let keyword.
All the examples given in this problem are misleading because they all use let:
let [foo, , baz] = numbers;let {width:x, depth} = box;
So the learner is not aware that the keyword must be left off if wishing to assign to an object's properties.
I would add another example so that the learner has all the pieces of the puzzle in front of them before they embark on solving it.
I've just spent quite a bit of time on problem 5 because there is no information in the instructions (or on the web for that matter) about how to do a destructured assignment into an object.
If you google ES6 destructuring, all the examples show assignments to simple variables rather than object properties.
The given solution achieves this using
[, result.username, result.email] = args;
which works, but can be the source of many frustrations because it gives an unhelpful syntax error if preceded with thelet
keyword.All the examples given in this problem are misleading because they all use
let
:let [foo, , baz] = numbers;
let {width:x, depth} = box;
So the learner is not aware that the keyword must be left off if wishing to assign to an object's properties.I would add another example so that the learner has all the pieces of the puzzle in front of them before they embark on solving it.