Usually I use this:
myVar = "myString is" + 1 === 1 ? " really true" : " false, I think";
Maybe I need just the true part, let's say:
myVar = "myString is" + 1 === 1 ? " really true" : "";
I don't like this part: : "" because is useless.
Is there a way to use something like the below?
myVar = "myString is" + 1 === 1 && " really true";
It works but there is a problem when is false because it writes "false"!
"myString is" + 1 === 1 && " really true"is evaluated as((("myString is" + 1) === 1) && (" really true"))."myString is" + 1is"myString is1", which is not equal to1.1 === 1 && " really true"inside parentheses()like I've shown in my answer, but will still write something likemyString is falsewhich I don't know if it's acceptable to you or not.""is the way to go.