不确定我是否理解这个嵌套的三元运算

Not sure I understand this nested ternary operation

可以使用一些帮助理解(或帮助更正),以及解释或 link 关于你是如何知道的,这样我可以在我再次 运行 时弄清楚这些。 None 我发现的教程非常有用。这是操作。括号表示一个时间序列(数组):

a = b==1 ? c ? d : e > a[1] ? e : a[1] : c ? d : a[1]

翻译后,将是:

a = if b==1 and c then d 
    else if e > a[1] then e 
    else a[1] 
    else if c then d
    else a[1]

……对吧?如果正确的话,我不明白 else 怎么会出现在两个 else-if 之间。链条不会在第一个 else 之后停止评估吗?我认为 else 本质上是指“否则”。

我相信执行将等同于此而不是 b == 1 and c:

function test() {
    if (b==1) {
        if (c) {
            return d;
        } else {
            if (e > a[1]) {
                return e;
            } else {
                return a[1];
            }
        }
    } else {
        if (c) {
            return d;
        } else {
            return a[1];
        }
    }
}

a = test();