?: style (requires expressions on either side of the :
):
typeof(someVariable) != 'undefined' ? someFunction : null;
Ninja-style:
someVariable !== undefined && someFunction(someVariable);
[Edit: I couldn've sworn noop
was a thing in Javascript, but apparently I was wrong. Switched to null
]