<legend id='oeiSJ'><style id='oeiSJ'><dir id='oeiSJ'><q id='oeiSJ'></q></dir></style></legend>

  1. <tfoot id='oeiSJ'></tfoot>

    <small id='oeiSJ'></small><noframes id='oeiSJ'>

  2. <i id='oeiSJ'><tr id='oeiSJ'><dt id='oeiSJ'><q id='oeiSJ'><span id='oeiSJ'><b id='oeiSJ'><form id='oeiSJ'><ins id='oeiSJ'></ins><ul id='oeiSJ'></ul><sub id='oeiSJ'></sub></form><legend id='oeiSJ'></legend><bdo id='oeiSJ'><pre id='oeiSJ'><center id='oeiSJ'></center></pre></bdo></b><th id='oeiSJ'></th></span></q></dt></tr></i><div id='oeiSJ'><tfoot id='oeiSJ'></tfoot><dl id='oeiSJ'><fieldset id='oeiSJ'></fieldset></dl></div>

      • <bdo id='oeiSJ'></bdo><ul id='oeiSJ'></ul>

      Javascript“元组"符号:它的意义是什么?

      时间:2023-10-02

        • <legend id='XINrB'><style id='XINrB'><dir id='XINrB'><q id='XINrB'></q></dir></style></legend>
        • <i id='XINrB'><tr id='XINrB'><dt id='XINrB'><q id='XINrB'><span id='XINrB'><b id='XINrB'><form id='XINrB'><ins id='XINrB'></ins><ul id='XINrB'></ul><sub id='XINrB'></sub></form><legend id='XINrB'></legend><bdo id='XINrB'><pre id='XINrB'><center id='XINrB'></center></pre></bdo></b><th id='XINrB'></th></span></q></dt></tr></i><div id='XINrB'><tfoot id='XINrB'></tfoot><dl id='XINrB'><fieldset id='XINrB'></fieldset></dl></div>
            <bdo id='XINrB'></bdo><ul id='XINrB'></ul>

            <tfoot id='XINrB'></tfoot>

                <tbody id='XINrB'></tbody>

                <small id='XINrB'></small><noframes id='XINrB'>

                本文介绍了Javascript“元组"符号:它的意义是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                在 wtfjs,我发现以下是合法的javascript.

                At wtfjs, I found that the following is legal javascript.

                ",,," == Array((null,'cool',false,NaN,4)); // true
                

                参数 (null,'cool',false,NaN,4) 对我来说看起来像一个元组,但 javascript 没有元组!

                The argument (null,'cool',false,NaN,4) looks like a tuple to me, but javascript does not have tuples!

                我的 javascript 控制台中的一些快速测试会产生以下结果.

                Some quick tests in my javascript console yields the following.

                var t = (null,'cool',false,NaN,4); // t = 4
                (null,'cool',false,NaN,4) === 4; // true
                (alert('hello'), 42); // shows the alert and returns 42
                

                它的行为似乎与分号 ; 分隔的语句列表完全一样,只是返回最后一条语句的值.

                It appears to behave exactly like a semicolon ; separated list of statements, simply returning the value of the last statement.

                在某处有描述此语法及其语义的参考吗?为什么会存在,即应该在什么时候使用?

                Is there a reference somewhere that describes this syntax and its semantics? Why does it exist, i.e. when should it be used?

                推荐答案

                你看到了 逗号运算符.

                逗号运算符计算其两个操作数(从左到右)并返回第二个操作数的值.

                The comma operator evaluates both of its operands (from left to right) and returns the value of the second operand.

                a,b,c,...,n 求值时的结果值将始终是最右边表达式的值,但是链中的 所有 表达式仍在评估中(从左到右).

                The resultant value when a,b,c,...,n is evaluated will always be the value of the rightmost expression, however all expressions in the chain are still evaluated (from left to right).

                这篇关于Javascript“元组"符号:它的意义是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                上一篇:在新窗口中打开页面而不阻止弹出窗口 下一篇:如何包含从 Nuget 安装的 JavaScript 包?

                相关文章

              • <tfoot id='VwujQ'></tfoot>

                  1. <small id='VwujQ'></small><noframes id='VwujQ'>

                    • <bdo id='VwujQ'></bdo><ul id='VwujQ'></ul>
                  2. <legend id='VwujQ'><style id='VwujQ'><dir id='VwujQ'><q id='VwujQ'></q></dir></style></legend>
                    <i id='VwujQ'><tr id='VwujQ'><dt id='VwujQ'><q id='VwujQ'><span id='VwujQ'><b id='VwujQ'><form id='VwujQ'><ins id='VwujQ'></ins><ul id='VwujQ'></ul><sub id='VwujQ'></sub></form><legend id='VwujQ'></legend><bdo id='VwujQ'><pre id='VwujQ'><center id='VwujQ'></center></pre></bdo></b><th id='VwujQ'></th></span></q></dt></tr></i><div id='VwujQ'><tfoot id='VwujQ'></tfoot><dl id='VwujQ'><fieldset id='VwujQ'></fieldset></dl></div>