Introduction
ES2015(ES6) introduced template literals, a powerful way of working with strings
// with template literals
const name = `Brenda`
const sentence = `My name is ${name}!`
console.log(sentence) // My name is Brenda!
Multi-line strings with back-tics (``)
These are strings that span several lines:
const techStack = `
- HTML
- CSS
- Tailwind
- Supabase
`
console.log(techStack)
// - HTML
// - CSS
// - Tailwind
// - Supabase
// Example 2:
const multilineText = `
Est eius soluta est reiciendis nesciunt ut aperiam accusamus a galisum illum sed perspiciatis voluptatem. Ea vitae itaque et culpa explicabo et nostrum modi. Eum error commodi ut possimus nostrum eum vitae dolorem et autem quia et laboriosam voluptatum qui natus beatae 33 beatae provident.
`
console.log(multilineText)
With the backticks, we can indent into a new line and enclose the end of the multi-line string with the ending (`)
You may follow me on Twitter where I tweet about interesting topics on software development.