News for hackers. Stuff that matters.
Re:Pythonic syntax to declutter Javascript by TNO on Thursday January 14, 2010 @10:23PM (#1054160)
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;
Re:Pythonic syntax to declutter Javascript by jrockway on Thursday January 14, 2010 @10:57PM (#1054210)
Is ?: really not right-associative in JavaScript? I thought PHP was the only language that messed that one up...
Re:Pythonic syntax to declutter Javascript by TNO on Thursday January 14, 2010 @11:01PM (#1054217)
I wrapped it with parentheses out of habit. updated
Re:Pythonic syntax to declutter Javascript by jrockway on Thursday January 14, 2010 @11:04PM (#1054219)
That's a relief :)
Re:Pythonic syntax to declutter Javascript by WalkingDead on Friday January 15, 2010 @04:06AM (#1054540)
Doesn't work on V8, at least not on the version I am using. Which JS engine is 1.8.1 complaint?
Re:Pythonic syntax to declutter Javascript by sid0 on Friday January 15, 2010 @07:21AM (#1054734)
SpiderMonkey in Firefox 3.5 and above.