---
title: "Discussion on \"Understanding tagged template literals in JavaScript\" | Hashnode"
description: "Discussion on \"Understanding tagged template literals in JavaScript\". Introduction\nYou’ve probably come across template literals when writing JavaScript:\nfunction sayHi(name) {\n    console.log(`Hi, ${name}!`);\n}\n\nsayHi(\"Zach\"); // \"Hi, Zach!\"\n\nTemplate literals are handy for their ability to interpolate values and crea..."
url: "https://hashnode.com/posts/understanding-tagged-template-literals-in-javascript/623f461b2209c88a3de91eb2"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Understanding tagged template literals in JavaScript](https://zachsnoek.hashnode.dev/understanding-tagged-template-literals-in-javascript?utm_source=hashnode&utm_medium=feed)

Introduction You’ve probably come across template literals when writing JavaScript: function sayHi(name) { console.log(\`Hi, ${name}!\`); } sayHi("Zach"); // "Hi, Zach!" Template literals are handy for their ability to interpolate values and crea...

Mar 26, 2022 · 6 min read · zachsnoek.hashnode.dev  
Read the article

-   [#javascript](https://hashnode.com/tag/javascript)
-   [#web-development](https://hashnode.com/tag/web-development)

## Written by

[Zach Snoek](https://hashnode.com/@zachsnoek)

@zachsnoek · Washington, USA

  
[View profile](https://hashnode.com/@zachsnoek)

Software Engineer

## Responses 1

Markdown supported · ⌘↵ to post

[Victor Souza](https://hashnode.com/@victor0x16)

[Mar 27, 2022](https://hashnode.com/posts/understanding-tagged-template-literals-in-javascript/623f461b2209c88a3de91eb2/comment/623faede2209c88a3de92690)

**Clearly explained!** thanks for sharing it✨✨

I'll play with it more later :)

```
function bold(strings, ...args) {
    return [strings, args[1](args[0])];
}

const html = bold`7^2 =${7}${function square(x) { return x*x; }}`;
console.log(html.join(" "));
```
