I want to create multiline text using multiple ternary operators within a single Template literal.
const toolTipText = `${2 * 5 === 10 ? "The value is same" : ""}
${"a" === "b" ? "" : "Different letters"}`;
console.log(toolTipText);
For example, in the code above, I want The value is same
in one line & Different letters
in the next line. However, they are both in the same line. I am basically trying to add lines on text based on conditions.
How to achieve it?
` tag. – Michael M. May 29 '23 at 04:58