It is great that you solved the challenge, but instead of posting your full working solution, it is best to stay focused on answering the original poster’s question(s) and help guide them with hints and suggestions to solve their own issues with the challenge.
I totally agree with your view and in this case, I was giving the answer away too quickly.
But let me ask you another question, to someone like you with clearly more experience in the field. What do you see as a healthy balance between guiding someone with hints and suggestions or - more satirically speaking - letting a peer suffer in his or her eternal search for the right answer? Where is the threshold here exactly?
We have a strict ‘no writing the answers for them’ policy for freeCodeCamp challenge problems. We’ll occasionaly share code snippits for people who have already solved a challenge or for people working on code projects, but this forum is not a ‘give me code that does X’ service.