Build a card counting assistant - not sure what my code should be doing

Hi Fcc family, so i’ve been banging my head for hours now, i’m not sure what the code is supposed to do i’ts so frastating. i cannot figure out the logic as to what am i supposed to do. i just followed the user stories and this is what i came up with, honestly i don’t know what i’m doing. also, not just with this challenge but other challenges as well, i can get the simple logic of if/else statements but i struggle to connect everything into one function that has a flow .

link to my code

https://codepen.io/Refilwe-Dikutle/pen/azdqeoz

I don’t understand why you are reassigning the value of card inside of your function?

you are changing the value of card and then you are doing checks that use the previous value of the card. Make sure your code has a logical flow that you can follow