Empty arrays seem to equal true and false at the same time

前端 未结 9 2171
别跟我提以往
别跟我提以往 2020-11-22 10:23

Empty arrays are true but they\'re also equal to false.

9条回答
  •  遇见更好的自我
    2020-11-22 11:00

    None of the above helped me, when trying to use the knockout.js mapping plugin, perhaps since an "empty array" isn't really empty.

    I ended up using: data-bind="if: arr().length" which did the trick.

    This is specific to knockout, not the OP's question, but maybe it will help someone else browsing here in a similar situation.

提交回复
热议问题