Is there a way to do conditional within a template string?
For example:
let x, y;
x = ...
y = ...
let templateString = `${x} ${y}`;
I don't want the space in the template string after x to be output if y is undefined. How would I achieve that with template string?
Is this the only way to do it?
let templateString = `${x}${y ? ' ' + y : ''}`;