I wanted to try using template literals and it’s not working: it’s displaying the literal variable names, instead of the values. I am using Chrome v50.0.2 (and jQuery).
console.log('categoryName: ${this.categoryName}\ncategoryElements: ${this.categoryElements} ');
${this.categoryName}
categoryElements: ${this.categoryElements}
You need to use backticks (otherwise known as "grave accents" - which you'll find next to the 1 key if you're using a QWERTY keyboard) - rather than single quotes - to create a template literal.
Backticks are common in many programming languages but may be new to JavaScript developers.
Example:categoryName="name";
categoryElements="element";
console.log(`categoryName: ${this.categoryName}\ncategoryElements: ${categoryElements} `)
Output:
VM626:1 categoryName: name
categoryElements: element
See: