JS string templates with back-ticks

JS string templates with back-ticks
0.0 0

#1

Can we use the ES6 template strings denoted by backticks? I was attempting to return a simple string of two variables in the online code editor but the code gives an error about missing }. Below is the code for the problem I was working on, the return statement throws the error.

var count = 0;

function cc(card) {
  // Only change code below this line
  var decision = "Hold";
  switch(card) {
    case 2:
    case 3:
    case 4:
    case 5:
    case 6:
      count+=1;
      break;
    case 10:
    case "J":
    case "Q":
    case "K":
    case "A":
      count-=1;
      break;
  }
  console.log("testing");
  if (count > 0) {
    decision = "Bet";
  }
  return `${count decision}`;
  //return count.toString()+" "+decision;
  // 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');

#2

You have to call both variables individually, for i.e: `${count}${decision}`;


#3

Thank you, this resolved the issue!