4 ms·
With JavaScript 1.8.1: function triangle(a,b) a <= 0 || b <= 0 ? 0 : (a = a*a + b*b) > 0 ? Math.pow(a,.5) : 0;
by TNO 17y ago
With JavaScript 1.8.1:
function triangle(a,b)
a <= 0 || b <= 0 ? 0 : (a = a*a + b*b) > 0 ? Math.pow(a,.5) : 0;
- jrockway 17y agoIs ?: really not right-associative in JavaScript? I thought PHP was the only language that messed that one up...
- WalkingDead 17y agoDoesn't work on V8, at least not on the version I am using. Which JS engine is 1.8.1 complaint?
- sid0 17y agoSpiderMonkey in Firefox 3.5 and above.