Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Splitting on several lines
Message
From
01/06/2013 13:20:40
 
 
To
01/06/2013 13:12:16
General information
Forum:
Javascript
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01575403
Message ID:
01575404
Views:
52
>Anyone would have the proper syntax to split that line into several lines:


I use this general style:

If it's a single ternary:
largest = ((a > b) ? a : b);
If it's a multi-clause ternary (such as your example), I always:

(1) Put parenthesis around the test clause
(2) Indent each true and false clause within
return (typeof loWindow.pageYOffset != 'undefined') ?
        loWindow.pageYOffset :
        (document.documentElement.scrollTop) ?
            (document.documentElement.scrollTop) : 
            (document.body.scrollTop) ? 
                document.body.scrollTop :
                0
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform