Freecodecamp: Wrong instructions

Created on 3 Mar 2020  ·  14Comments  ·  Source: freeCodeCamp/freeCodeCamp

Challenge: https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/basic-javascript/nesting-for-loops

" Modify function multiplyAll so that it multiplies the product variable by each number in the sub-arrays of arr"

That would mean multiplying each number in the sub-arrays of ‘arr’ by 1, while the “official” solution of the challenge is (product *= arr[etc. etc.] since the problem instructions never specifies the PRODUCT variable should be changed at any point.

I would solve this contradiction by putting product as an argument of the function and making the student code it, or just changing the instructions to ask to multiply each element by 1.

first timers only help wanted learn

All 14 comments

I see very few people making this mistake on the forum. I came across one post where someone did. So I guess we could maybe make it a little more clear.

just changing the instructions to ask to multiply each element by 1.

I don't like this because it's not really what the challenge was designed to have happen.

I would solve this contradiction by putting product as an argument of the function and making the student code it

This isn't bad, but then the hints and solution would need to be updated. So I would prefer to just change the instructions around a little so it's more clear.

Hi, I've never contributed to an open-source project before and Free Code Camp is one of the resource that got me into coding in the first place, so if there's an opportunity to help it'd be awesome!

I was thinking that the instructions aren't too bad on this example, but it could help to include an example of how the code should work. I would probably just add a line under the current instructions that says something along the lines of:

For example: multiplyAll([2,3], [ 4,5]) should return the product of 1 * 2 * 3 * 4 * 5, where the 1 comes from the initial value of the "product" variable.

For example: multiplyAll([2,3], [ 4,5]) should return the product of 1 * 2 * 3 * 4 * 5, where the 1 comes from the initial value of the "product" variable.

I don't know about adding this example. It feels unnecessary.

I agree with changing the wording. What about this:

Modify function multiplyAll so that it performs repeated multiplication on the product variable with each number in the sub-arrays of arr.

OR

Modify function multiplyAll so that it multiplies each number in the sub-arrays of arr with one another times the product variable.

Those are the only ways I can think of rewording, without any additional context.

I personally do not see a reason to change this challenge, but if others agree it needs to be changed, then I would vote for @Sky020's second suggestion above.

I like this...

Use a nested loop to make the multiplyAll function return the product of all the numbers in the sub-arrays of arr.

I gave it some thought. I would solve it by sticking to a recurring pedagogical device in other challenges of FCC:
Make the instructions clear about "obtaining the product of each number and the next one", and provide a code example that does a similar operation with a different array, perhaps a division or addition.

"Multiplying product variable by each number" sounds correct to me

since the problem instructions never specifies the PRODUCT variable should be changed at any point

I'm not sure it's possible to perform this without changing product variable. It's kinda implicit here

As this issue is going stale: I suggest we make this a _first-timers_ issue with the following expected change:

Modify function multiplyAll so that it returns the product of all the numbers in the sub-arrays of arr.

Hello. I am new and would love to contribute.
I would like to fix this issue, if no one is already on it.

@THE-VR7 , I do not think anyone is working on it. Go ahead 👍 . Be sure to read our Contributing Documentation, if you have not already.

sir can you help me understand the code

@THE-VR7 , sure. Generally, I recommend you either send a message on the Contributors chat room on Gitter, or you can ask on the forum.

What are you struggling to understand, so far?

I saw there had been no activity on this for almost a week, so I wanted to try my hand at making my first contribution.

Was this page helpful?
0 / 5 - 0 ratings