After seeing the title, you might think, what kind of formula is this?
To be honest, I haven't found a direct answer to this question myself on the Internet.
This is what I encountered when I was debugging the js code, and I was puzzled for a long time, thinking that this is some syntax that I have never learned.
In fact, it is very simple. First of all, it can be disassembled like this: A? B? C: D : E
Let the longest part in the middle be F, then this formula can be written as: A?F:E
Typical C language ternary operator.
Let the value of this formula be equal to G,
Ner G = A?B?C:D:E;
Written into code is:
if(A==true)
{
if(B==true)
G = C;
else
G = D;
}
else
{
G = E;
}
//G = A?B?C:D:E
参考资料:[Solved] Where do you put parentheses in the following javascript statement - CodeProject