In this weekly series, I will be taking out coding problems from CodeWars and sharing a step-by-step tutorial on how exactly I was able to solve it...
For further actions, you may consider blocking this person and/or reporting abuse
Your function definition is wrong and doesn't match what you've stated - the function you have defined doesn't take an array at all - rather an arbitrary number of arguments that will be converted to an array. If someone were to pass an empty array to the function, rightly expecting to get the "no likes" result according to your description - it wouldn't work.
Admittedly, defining the function and calling it the way you have (using the spread operator) does make the function more flexible, but if you're going to always pass an array, or maybe extend the function to accept other parameters - then you're better off dropping the rest parameter and making the function actually accept an array rather than forming an array from its arguments
Hi, Jon.
Thank you so much for sharing your insight.
Thanks for sharing King.
You can concise this code a bit further and avoid repeating the same strings or values using temporals in Javascript.
Here is my version:
jsfiddle.net/iStealersn/12uetjgv/4/
Awesome!
Thanks for sharing
Some good improvements to make things more DRY, but the nested ternary's make my brain bleed. I feel like this would be much more legible using a switch or even just if/else statements.
Yeah I agree, had the same feeling after completion. If/Else statements make it look long while switch may definitely help gotta give a shot
If you have an improved version please share, it will be helpful
Here's a solution that takes a few more things into account:
Nice solution. This does not say "and x others" though.
Awesome!
This is even shorter and better. Thanks for sharing.
Thanks for making this post.
It's a nice idea to share question in this forum.
Here is my version. What do you guys think
It's shorter!
My version using destructuring. Criticism is welcome
This isn't necessary
No need for a loop, the number of names is always
names.length
Thank you for input.
Like I said, this is how I solved it the first time.
I always enjoy seeing the steps each person takes to accomplishing these challenges, thanks for the write up!
Thank you!