javascript - Using conditionals inside template literals -
i know more elegant way define string variables included, if want add conditional in pre es6 do.. var = "text"+(conditional?a:b)+" more text" now template literals do.. let a; if(conditional) = `test${a} more text`; else = `test${b} more text`; is there more elegant way implement conditional? possible include if shortcut? use this: let = `test${conditional ? : b} more text`;