The HTML-template example does not escape interpolated values and can enable script injection when copied
Source references: 1`highlight` directly concatenates supplied values into `<mark>` HTML without HTML escaping. Although the example uses a fixed name and age, the general-purpose function does not restrict where values come from.
If a site passes user-submitted names, search terms, or other untrusted text to this function and inserts the result as HTML, an attacker could inject markup or script and act with the current user's page access.
This is a tagged-template demonstration. The function does concatenate values into HTML without escaping, but the visible example passes only a fixed name and age and does not insert the result into the DOM or another HTML-parsing sink. Script injection would require untrusted string input plus later HTML interpretation, neither of which is shown. A user can ask the author to label the helper as unsuitable for untrusted input or provide an escaping example.
This assessment concerns the code and conditions shown, not proof that harm has occurred.// Tagged template literalsfunction highlight(strings, ...values) { return strings.reduce((result, str, i) => { const value = values[i] || ""; return result + str + `<mark>${value}</mark>`; }, "");}const name = "John";const age = 30;const html = highlight`Name: ${name}, Age: ${age}`;// Output: "Name: <mark>John</mark>, Age: <mark>30</mark>"```