JavaScript multivariate operators
* * Example:* * '
function Test (9) {
var a=4,b=11;
< Span class= "token lf" > return p > 1? p<b? p > b:p = 6:p = 3;
} document.write (Test (9);
< Span class= "token lf" > < Span class= "token lf" > ** parse **:
< Span class= "token lf" > < Span class= "token lf" > Span id= "wmd-input-section-2" class= "wmd-input-section" >----------
In this example above, the quickest way to solve this is to find the first question mark"? ", and the last colon": "and then split the statement,
< Span class= "token lf" > < Span class= "token lf" > < Span id= "wmd-input-section-2" class= "wmd-input-section" > i.e.: return p > 1? Overall statement: P = 3;
< Span class= "token p" > < Span class= "token lf" >< Span class= "token lf" > analysis Step One: When P>1 is true, output the whole statement, that is: P<b? p > b:p = 6;
< Span class= "token p" > < Span class= "token lf" >< Span class= "token lf" > analysis Step Two: When P>1 is false, output p = 3;
< Span class= "token lf" >< Span class= "token lf" > In this case, p=9, perform the analysis step one, then output: P<b? p > b:p = 6;
< Span class= "token lf" >< Span class= "token lf" > similarly:
< Span class= "token p" > < Span id= "wmd-input-section-2" class= "wmd-input-section" >< Span class= "token p" >< Span class= "token lf" > analysis Step One: When P<b is true, output p > b;
< Span class= "token lf" >< Span class= "token lf" > analysis Step Two: When P<b is false, output P = 6;
< Span class= "token strong" > < Span class= "token lf" >< Span class= "token lf" > i.e.: 9<11 is true, output p> b, that is, 9>11, that is, false.
JavaScript multivariate operators