Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript template strings

//Template strings allow you to inject values into a string while 
//preserving the format. Your code becomes more reader friendly.
//Use it instead of 'string arithmetic'.

let userName = 'John Doe';
let finalResult = 234;

//template string
console.log(`Hello ${userName} your final result is ${finalResult}`);

//'string arithmetic'
console.log("Hello " + userName + " your final result is " + finalResult);
 
PREVIOUS NEXT
Tagged: #javascript #template #strings
ADD COMMENT
Topic
Name
4+4 =