I nuked this lesson so hard

Tell us what’s happening:
I let the existing code goof me up.

  **Your code so far**

const sum = (x, y, z) => {
const args = [x, y, z];
return args.reduce((a, b) => a + b, 0);
}

A week ago or so, I stared at this challenge, after having a ‘few’ too many whiskeys and waters, and I said, “golly gee, I don’t know what to do with those darn dot dot dot boys at all right now”

Today/this-morning, while still having had, somehow, too many whiskeys and waters, I managed to solve this challenge … and felt that the deletion requirement was ‘sneaky’. My console was telling me I already declared ‘args’… til that sweet sweet delete.

Challenge passed.

I know this is something like a non-idiom, but I hope it helps someone.

  **Your browser information:**

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.71 Safari/537.36

Challenge: Use the Rest Parameter with Function Parameters

Link to the challenge:

Cool, good job. We all remember the feeling of struggling with something and then the ecstasy of everything falling into place. And reduce is one that can be tricky for beginners.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.