'ifthenelse' command in math block

Request

I want to use \newcommand to define a command which has different behaviors depending on the parameters.

Problem

My problem is that the latex command ifthenelse cannot be used in mathjax. Is there a similar command in mathjax?