```js
var count = 0;
var result;
function cc(card) {
if (card <= 6) {
count += 1;
result = count + " Bet";
} else if (card <= 9) {
if (count < 1) {
result = count + " Hold";
} else {
result = count + " Bet";
}
} else {
count -= 1;
if (count < 1) {
result = count + " Hold";
} else {
result = count + " Bet";
}
}
return result;
}
// Add/remove calls to test your function.
cc(2);cc(2); cc(10);
```
A simple blackjack card counting
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.