1var animal = "cow";
2var str=`The ${animal} jumped over the moon`; // string interpolation
1//Regular string
2var rgb = "rgb(" + r + "," + g + "," + b + ")";
3//Template literal
4var rgb = `rgb(${r}, ${g}, ${b})`;
1`string text`
2
3`string text line 1
4 string text line 2`
5
6`string text ${expression} string text`
7
8tag`string text ${expression} string text`
1// TEMPLATE LITERALS example
2console.log(`Hi, I'm ${p.name}! Call me "${p.nn}".`);
1// Template String: If you want both double and single quotations in your string
2// NOTE: also allows multiple line strings
3// Find it above the leftmost tab key on your keyboard
4let AllQuotationString = `Can use this for ', or ", or ${yourVariable}, or
5 multiline strings`;
6
7// Single Quotation String: If you want double quotations in your string
8let SingleQuotationString = 'can contain " in string, but not ${yourVariable}';
9
10// Double Quotation String: If you want single quotations in your string
11let DblQuotationString = "can contain ' in string, but not ${yourVariable}";