-2

Would like to put the variable ( txt.txt.charAt(char_counter) )in quotes. Anyone can help? Thanks

var pattern_node = document.createTextNode("Zeichen:"+txt.txt.charAt(char_counter)+" "+ str.str +" gesendet");
Omi in a hellcat
  • 376
  • 6
  • 22
  • You could either use a template string `\`Zeichen: "${txt.txt.charAt(char_counter} gesendet\``, or add the strings by escaping the quote in the string (`"\""`) or use single quotes (`'"'`) – GammaGames Oct 17 '19 at 18:53
  • `var pattern_node = document.createTextNode('Zeichen:"'+txt.txt.charAt(char_counter)+'" '+ str.str +' gesendet');` – admcfajn Oct 17 '19 at 18:55

1 Answers1

0

ES6/ES2015 feature, template string

var pattern_node = document.createTextNode(`Zeichen:${txt.txt.charAt(char_counter)} ${str.str} gesendet`);
sam
  • 1,439
  • 10
  • 14