Just so I can follow the program and after trying a couple of things, I reduced the code to
var count = 0;
function cc(card) {
// Only change code below this line
console.log(card);
return "Change Me";
// Only change code above this line
}
// Add/remove calls to test your function.
// Note: Only the last will display
cc(2); cc(3); cc(7); cc('K'); cc('A');
just to see how the program is running by default and how the cc() functions get picked to run.
Looking at the console log, the program seems to do a lot more than just run those 5 functions. It just keeps going, like:
counting-cards:7 2
counting-cards:7 3
counting-cards:7 7
counting-cards:7 K
counting-cards:7 A
VM1302:7 2
VM1302:7 3
VM1302:7 7
VM1302:7 K
VM1302:7 A
counting-cards:7 2
counting-cards:7 3
counting-cards:7 4
counting-cards:7 5
counting-cards:7 6
counting-cards:7 7
counting-cards:7 8
counting-cards:7 9
counting-cards:7 10
counting-cards:7 J
counting-cards:7 Q
counting-cards:7 K
counting-cards:7 A
counting-cards:7 3
counting-cards:7 7
counting-cards:7 Q
counting-cards:7 8
counting-cards:7 A
counting-cards:7 2
counting-cards:7 J
counting-cards:7 9
counting-cards:7 2
counting-cards:7 7
counting-cards:7 2
counting-cards:7 2
counting-cards:7 10
counting-cards:7 3
counting-cards:7 2
counting-cards:7 A
counting-cards:7 10
counting-cards:7 K
The first two runs, the values stay the same so I get it. The VM thingy needs to do it’s own thing I suppose. But then, what’s the deal with all those other values after the second loop. They seem to change.
The reason I ask is because I made a copy of a working solution from the forum after trying many things. But the code from the forum won’t pass as valid so I’m on it myself trying to debug it but the debug output is only extra confusing.