I had seen this question on an interview a few months ago, but I wanted to confirm my answer.
(I'm writing a blog post of past interview questions to clarify my answers.)
if (foo) { bar.doSomething(el); }
else { bar.doSomethingElse(el); }
Answer:
foo ? bar.doSomething(el) : bar.doSomethingElse(el);