Search posts, tags, users, and pages
Zach Snoek
Software Engineer
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...
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(" "));
Victor Souza
Web Developer from π Canis Majoris.
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(" "));