The best thing to do in order to use quotes within a string in JavaScript is to use backticks (` `) instead of single or double quotes. Let’s see this with an example:
let secondString = "this is "green"";
let thirdString = `this is 'blue'`;
console.log(secondString);
// this returns an error
console.log(thirdString);
// returns -- this is 'blue'
Another way is to use the backward slash (\) in the following way:
let secondString = "this is \"green\"";
console.log(secondString);
// returns -- this is "green"