Skip to content

Instantly share code, notes, and snippets.

Created October 16, 2020 16:51
What would you like to do?
Funtion that transforms dynamic value to bold elements
const makeBold = (strings, ...values) => {
let str = '';
strings.forEach((string, i) => {
str += `${string} ${values[i] ? `<strong>${values[i]}<strong>` : ''}`;
return str;
const name = 'Kannan';
const role = 'Javascript developer';
makeBold`My name is ${name} and I am a ${role}`;
// My name is <strong>Kannan<strong> and I am a <strong>Javascript developer<strong>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment