Inserting grave accent in multline js string

Viewed 57

I'm trying to setup a code with:

const scriptTexta = document.createTextNode(`
function validate${currNum}() {

if (document.getElementById("btn${currNum}").checked) {
    adminmessages[${currNum}] = [String.raw\`${br[0]}\`,String.raw\`${br[1]}\`,String.raw\`true\`,String.raw\`\`];
} else {
    adminmessages[${currNum}] = [String.raw\`${br[0]}\`,String.raw\`${br[1]}\`,String.raw\`false\`,String.raw\`\`];
}
}
`);

br is defined correctly, however I think there's an error with me including ` inside a multiline string. I don't really know how to fix it, and I definitely have to use String.raw, so I'm stuck....

0 Answers
Related