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');
1 ответ
0
When creating formatted strings. Just like how you are using it. It's cleaner then using + operator for string concatenation. Also, more predictable.