All objects in JavaScript are truthy per the spec, but in the DOM one non-primitive object is not. Which?

后端 未结 4 2095
日久生厌
日久生厌 2020-12-16 18:38

There is this tweet on Twitter:

In JavaScript, all objects are truthy (as per the spec). In the DOM, there’s one exception to this rule. What is it? #

4条回答
  •  伪装坚强ぢ
    2020-12-16 19:25

    Just loop over the document and test all..

    http://jsfiddle.net/UTNkW/3/

    EDIT: Wrong test methodology, thankfully someone pointed it out and I could correct it.

提交回复
热议问题