Possible error in the challenge "JavaScript Algorithms and Data Structures"

It seems to me that in the task “Add Elements to the End of an Array Using concat Instead of push”, the correct answer should be such an array “[1, 2, 3, [4, 5]]”, and not the proposed “[1 , 2, 3, 4, 5]”, because the assignment says “Change the nonMutatingPush function so it uses concat to add newItem to the end of original instead of push. The function should return an array.”, not “Change the nonMutatingPush function so it uses concat to add the contents of newItem to the end of original instead of push. The function should return an array.”, as well as a comparison with the push method, which will give just the result I propose.

return original.concat([newItem])
as opposed to
return original.concat(newItem)
??

Or offer such a solution as the right one or change the wording of the task.

Thank you for helping make FCC better. Bugs can be reported as GitHub Issues. Whenever reporting a bug, please check first that there isn’t already an issue for it and provide as much detail as possible.

1 Like

Yes - this issue has been discussed for quite some time here - “Weird Instructions → Add Elements to the End of an Array Using concat Instead of push #45194” but has not yet been resolved.

1 Like