Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Splitting on several lines
Message
De
01/06/2013 13:20:40
 
 
À
01/06/2013 13:12:16
Information générale
Forum:
Javascript
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01575403
Message ID:
01575404
Vues:
47
>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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform