Hello! I am rather new at this, so I apologize in advance for any breach in etiquette or faux-pas.
After struggling for about a day and a half, maybe two, with JavaScript Intermediate Algorithm Scripting: Wherefore art thou Challenge, looking not only at the hints and previous lessons, but at outside resources as well, I finally reached a solution that satisfies all the requirements.
While I am ecstatic about having solved the challenge and mostly happy with the way my code looks. I would like to request, for someone more experienced than I to take a look at my solution and, if possible, critique my approach and code in general.
I included a link to the challenge as well as the code, formatted and in between spoiler tags.
Your code looks largely complicated for such an easy challenge… And the way you’re using .filter() methods is a big no-no-no! It should probably be forEach() instead.
You write code for a people to read, not for computer. Your code is your story and reading it I personally cannot get why array of keys of source object is named one.
Having come to realize that I will, hopefully, not be the only one reading thru the code that I write today, I have renamed some of the variables and will try to be more mindful thru the “baptism” process in the future. bool remained bool, it represents a boolean value, blue remained blue due to its, I feel, very localized usage.
Also modified the two uses of the ternary operator. The first one is now an if/else statement, and the second one was modified as per your example, which was enlightening. While curious about your statement regarding the purpose of the ternary operator, I do understand how it makes code more difficult to read.
Below, in between the spoiler tags is what the code looks like with the revisions made after reading your (@camperextraordinaire) comment as well as the comment @snigo wrote.
I see you use filter or map often without using their returned value. Those are powerful tools, but if you don’t use their returned value it is a great misuse. Please use them appropriately or swap them for something else. (like forEach)
also, more descriptive variables would be a great improvement, like also a comment or two if needed for complex steps