bazinis-naudojimastemplate-literalstagged-templates
function highlight(strings, ...rest) {
let str = "";
strings.forEach((string, i) => {
if (rest[i] != undefined){
str += `${string} <b>${rest[i]}</b>`;
} else {
str += `${string}`;
}
});
return str;
}
const name = "Kelvin";
const food = "Rice";
const sentence = highlight`My name is ${name} and I love eating ${food}, cool right?`;
document.body.innerHTML = sentence;