single return of ternary operator
Here is the shortest way.
A == 1 && execute_function();
yes:
(exists == 1) ? execute_function() : false;
runs function if exists is true else wont
Added: Doing just like following would be better:
if( A == 1 ) {
execute_function();
}
As using ternary operator in above case is not so fruitful, as you are checking only for the true side of the condition and do not care about what's in the false side.
condition ? (runTrue) : (runFalse);
is available in javascript.
https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Operators/Conditional_Operator