-1

How can I turn the following statement into a Ternary.

if($.isNumber(arg1))
{
    if($.isNumber(arg2))
    {
        // something
    }
}

I know how to do an IF / ELSE with a Ternary statement like:

var a = $.isNumber(arg1) ? arg1 : $.isNumber(arg2) ? arg2 : undefined

for example.

not sure how to do an IF / IF / ELSE though.

Any help?

Panomosh
  • 884
  • 2
  • 8
  • 18

1 Answers1

1
var a = $.isNumber(arg1) && $.isNumber(arg2) ? "something" : "nothing";
AO_
  • 2,573
  • 3
  • 30
  • 31
  • 1
    Thank you, I realised that might have been the code seconds after I posted :S Thanks for the help – Panomosh Feb 27 '14 at 16:57