I would like to know what is shortcode if in javascript?
Like in php:
$res = ($x > $y)? $x: $y;
What is its conversion to javascript?
This is the same in javascript :)
var res = (x > y) ? x : y;
var x = 2; var y = 3; var res = (x > y)? x: y;
Although perhaps the following would be better:
var res = Math.max(x, y);
Same. It is called triple:
var x = 10, y = 50, res = 0; res = (x > y) ? x : y; alert(res);
This is the same in javascript:
res = (y < x) ? x : y; or res = (x > y) ? x : y;
res = (y < x) ? x : y;
res = (x > y) ? x : y;
Here you: var res = x>y?x:y;
var res = x>y?x:y;