Skip to content

Instantly share code, notes, and snippets.

View kfranqueiro's full-sized avatar

Kenneth G. Franqueiro kfranqueiro

View GitHub Profile
// 1: how could you rewrite the following to make it shorter?
if (foo) {
bar.doSomething(el);
} else {
bar.doSomethingElse(el);
}
// 1A:
bar[foo ? 'doSomething' : 'doSomethingElse'](el);