Hunt the Ace of Spades -- JavaScript exercise