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?
white-space: nowrap;in CSS but no luck. Any suggestions?<br>tag.white-space: premight be a better style to apply. It will break lines at\ncharacters.