Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7911711
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T13:21:05+00:00 2026-06-03T13:21:05+00:00

There is this tweet on Twitter : In JavaScript, all objects are truthy (as

  • 0

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? #jsquiz #fronttrends

Does anyone know the answer?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T13:21:08+00:00Added an answer on June 3, 2026 at 1:21 pm

    Disclaimer: I’m the guy who tweeted that 🙂 It was a question I would ask and answer in my Front-Trends talk. I wrote that tweet 5 minutes before going on stage.


    Because of the 140-character limit on Twitter, the question is slightly ambiguous. The real question I was asking is the following.

    The ECMAScript spec defines ToBoolean() as follows:

    ToBoolean(condition), slide from my Front-Trends 2012 talk

    As you can see, all non-primitive objects (i.e. all objects that aren’t a boolean, a number, a string, undefined, or null) are truthy as per the spec. However, in the DOM, there is one exception to this — a DOM object that is falsy. Do you know which one that is?
    The answer is document.all. The HTML spec says:

    The all attribute must return an HTMLAllCollection rooted at the Document node, whose filter matches all elements.

    The object returned for all has several unusual behaviors:

    The user agent must act as if the ToBoolean() operator in JavaScript
    converts the object returned for all to the false value.

    The user agent must act as if, for the purposes of the == and !=
    operators in JavaScript, the object returned for all is equal to the
    undefined value.

    The user agent must act such that the typeof operator in JavaScript
    returns the string 'undefined' when applied to the object returned for
    all.

    These requirements are a willful violation of the JavaScript
    specification current at the time of writing (ECMAScript edition 5).
    The JavaScript specification requires that the ToBoolean() operator
    convert all objects to the true value, and does not have provisions
    for objects acting as if they were undefined for the purposes of
    certain operators. This violation is motivated by a desire for
    compatibility with two classes of legacy content: one that uses the
    presence of document.all as a way to detect legacy user agents, and
    one that only supports those legacy user agents and uses the
    document.all object without testing for its presence first.

    So, document.all is the only official exception to this ECMAScript rule. (In Opera, document.attachEvent etc. are falsy too, but that’s not specced anywhere.)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Am not sure there is a feature like , automatically update twitter tweet in
I want to find twitter user's past month tweet's total count, Is there any
hi i am working with Twitter, in this there will be two class, for
Is there a better, more concise way to do this: function getTweets(){ $.getJSON(http://search.twitter.com/search.json?callback=?&q=superfad, function(data){
Is there any way I can get the latest tweet/status update of multiple Twitter-friends
There's this ... MSDN page, IQueryable(Of T) Interface . Can you do a better
there is this check-in-out program here at my workplace, it only takes the data
there's this interesting problem i can not solve myself. I will be very glad,
There was this problem that has been asked about implementing a load byte into
There's this already populated database which came from another dev. I'm not sure what

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.