DEV Community

Discussion on: Daily Challenge #53 - Faro Shuffle

Collapse
 
chrisachard profile image
Chris Achard • Edited

Bit of practice with flatMap; I hadn't used it before - but I'm going to start now!

const faro = deck => deck
  .slice(0, (deck.length / 2))
  .flatMap((card, i) => [card, deck[i + (deck.length / 2)]])

arr = ['ace', 'two', 'three', 'four', 'five', 'six']

console.log(faro(arr))

EDIT:

So I had the bright idea to do a screencast of me solving the problem and posting it on youtube... any feedback is welcome! And if it goes well, maybe I'll do more of them in the future :) We'll see! I haven't done youtube before, so this is my first video on there!

youtu.be/srT3yqFsgCQ

Collapse
 
kerrishotts profile image
Kerri Shotts

Nicely done on the video! Very clear, and nicely put together. :-)

Collapse
 
chrisachard profile image
Chris Achard

Thanks!