Tagged template literals

Use ‘tagged template literals’ to run a template string through a function.

function boldMe(strs, ...vals) {
  let str = strs.map(
    (string, i) => `${string}${vals[i] ? `<b>${vals[i]}</b>` : ``}`
  );
  return str.join('');
}

const make = 'Porsche';
const model = '718 Cayman';
const sentance = boldMe`My next car is a ${make} ${model}`;
console.log(sentance);
🛠️ with ❤️ by Ash Hitchcock © 2020 | Uses