0

When is a well moment for use `${count}` in JavaScript?

let count = 0; function cc(card) { if (card > 1 && card <= 6) { count++ } else if (card == 10 || card == 'J' || card == 'Q' || card == 'K' || card == 'A') { count-- } if (count > 0) { console.log(`${count} Bet`) } else { console.log(`${count} Hold`) } } cc(2); cc(3); cc(7); cc('K'); cc('A');

11th Sep 2022, 6:01 PM
Josué Varela
Josué Varela - avatar
1 Antwort
0
When creating formatted strings. Just like how you are using it. It's cleaner then using + operator for string concatenation. Also, more predictable.
12th Sep 2022, 6:19 AM
Mustafa A
Mustafa A - avatar