I have the following terniary operator :(我有以下三级运算符:)
[',' , '|' , ';' , 'TAB'].forEach(separator => separatorSelect.append($('<option>', separator === 'TAB' ? {value: '', text: separator} : {value: separator, text: separator})));
if separator === tab then the value in the object should be '\t'.(如果分隔符===制表符,则对象中的值应为'\ t'。) It works.(有用。) But I'm wondering if there's aa way to do the terniary inside the object itself so i wont have to copy the whole object twice.(但是我想知道是否有一种方法可以在对象本身内部进行三级处理,这样我就不必复制整个对象两次。)
{value: 'terniary here?', text: separator}
Is that possible or is my way the only way it can be done?(这是可能的还是我唯一的方法?)
ask by Kevin.a translate from so
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…