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

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

        在 javascript 中,空字符串是否总是错误的布尔值?

        时间:2023-09-04
        <i id='LNdQc'><tr id='LNdQc'><dt id='LNdQc'><q id='LNdQc'><span id='LNdQc'><b id='LNdQc'><form id='LNdQc'><ins id='LNdQc'></ins><ul id='LNdQc'></ul><sub id='LNdQc'></sub></form><legend id='LNdQc'></legend><bdo id='LNdQc'><pre id='LNdQc'><center id='LNdQc'></center></pre></bdo></b><th id='LNdQc'></th></span></q></dt></tr></i><div id='LNdQc'><tfoot id='LNdQc'></tfoot><dl id='LNdQc'><fieldset id='LNdQc'></fieldset></dl></div>

              <legend id='LNdQc'><style id='LNdQc'><dir id='LNdQc'><q id='LNdQc'></q></dir></style></legend>
                <tbody id='LNdQc'></tbody>
              <tfoot id='LNdQc'></tfoot>
                <bdo id='LNdQc'></bdo><ul id='LNdQc'></ul>

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

                • 本文介绍了在 javascript 中,空字符串是否总是错误的布尔值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  在 JavaScript 中,

                  in javascript,

                  var a = '';
                  var b = (a) ? true : false;
                  

                  var b 将被设置为 false.

                  这是可以依赖的已定义行为吗?

                  is this a defined behavior that can be relied upon?

                  推荐答案

                  是的.Javascript 是 ECMAScript 的一种方言,ECMAScript 语言规范明确定义了这种行为:

                  Yes. Javascript is a dialect of ECMAScript, and ECMAScript language specification clearly defines this behavior:

                  ToBoolean

                  如果参数是空字符串(其长度为零),则结果为假;否则结果为真

                  The result is false if the argument is the empty String (its length is zero); otherwise the result is true

                  引自 http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-262.pdf

                  这篇关于在 javascript 中,空字符串是否总是错误的布尔值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:Javascript中new Boolean()的目的是什么? 下一篇:仅当表单有效时如何触发 jQuery 函数

                  相关文章

                • <tfoot id='iQkzi'></tfoot>
                    <bdo id='iQkzi'></bdo><ul id='iQkzi'></ul>

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

                    1. <legend id='iQkzi'><style id='iQkzi'><dir id='iQkzi'><q id='iQkzi'></q></dir></style></legend>
                    2. <small id='iQkzi'></small><noframes id='iQkzi'>