re: Javascript Sock Merchant Challenge - Solution 2 VIEW POST

re: A somewhat faster solution. const count = (ofValue, ary) => { let i = ary.length let c = 0 while(i--){ if(ary[i] === ofValue) {c++} } ...

I will take a closer look and since you don’t like to be put on the spot 😀 I think I want to have our discussion transcend the comments section with an article that captures the exchange.
In the meantime I’ll run a benchmark on it but as far as readability this seems easier to digest IMHO.
I have started to write in a more functional way and isolating the arity for flexible composition. I think in the end it comes down to choosing the right tool and style for the right job.

code of conduct - report abuse