re: Daily Challenge #53 - Faro Shuffle VIEW POST

re: A bit of golf: f=a=>,i)=>a[i/2+i%2*(a.length/2-.5)]) It works like this: .map((_,i) : "i" will be the index of the current e...

Taking into account that the input is an array, you could save some bytes by replacing [...a] with just a (for golf purposes).

Apart from that, the solution seems really specific to the problem, and doesn't work for different arrays. For example:

f(['ace', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight'])
//["ace", "four", "two", "five", "three", "six", "four", "seven"]
// there are 2 "four" and no "eight"

Thanks a lot for the input! The problem was in the 2.5 usage, which had to be replaced with a.length/2-.5. I updated my answer!

code of conduct - report abuse