From 25fa32724be18b1d6443834f561126bc0c913fe9 Mon Sep 17 00:00:00 2001 From: MrEidam Date: Wed, 9 Oct 2024 09:39:01 +0200 Subject: [PATCH] Better Aces --- main.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/main.js b/main.js index 157e0f0..9cd7b5b 100644 --- a/main.js +++ b/main.js @@ -94,6 +94,18 @@ function cardsleft(){ function addScore(num){ playerCards.push(num); + //? Filters out Aces + const withoutAces = playerCards.filter(e => e !== 'A'); + + const count = playerCards.length-withoutAces.length; + + //? Adds the aces to the end + for(let i=0; i { if(e === 'A'){