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 5956805
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T18:18:36+00:00 2026-05-22T18:18:36+00:00

I am reading through the Mozilla Manual on JavaScript, and I come to this

  • 0

I am reading through the Mozilla Manual on JavaScript, and I come to this point in my reading, Boolean object. I can’t see a single use for them. What’s their point? Why wouldn’t you use just true and false?

By the way, I don’t know Java at all and I’m not afraid of learning new things that consequently why I’m trying to learn JavaScript. I’m a PHP programmer, a back end guy, and I’d like to learn how to do some front end work, so I’m reading the Mozilla JavaScript Guide.

  • 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-05-22T18:18:37+00:00Added an answer on May 22, 2026 at 6:18 pm

    Because this is (somewhat sadly) how the language was defined — I suspect it was originally for performance/optimization; note the case of assignment to a string property below. (Java works similarly, although Scala and Python largely reject this distinction).

    Note that Boolean isn’t the only “wrapper type”. There are also String and Number, for instance.

    Because of this there remains a number of quirks (the below could just as much apply to Boolean):

    typeof("foo") // string
    typeof(new String("foo")) // object
    "foo" instanceof String // false
    new String("foo") instanceof String // true
    
    // result is undefined: a string is a primitive and silently "ate" the assignment
    // this also makes it a much cheaper value as it's not a "real" object
    x = "f"; x.bar = 42; x.bar
    
    // result is 42: a String is a "real" object with real properties!
    // however, this also means that it may have a good bit more overhead
    x = new String("f"); x.bar = 42; x.bar
    

    I know this didn’t “answer” the question, but rather chucks some more wood on the fire 😉

    The only real “gotcha” otherwise from the above is that perhaps new Boolean(false) is a truth-y value.

    Happy coding.

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

Sidebar

Related Questions

Reading through this question on multi-threaded javascript, I was wondering if there would be
Reading through this , I came to the bit on default values for function
I'm reading through the TAP Whitepaper , and am confused by this sample given
I was just reading through the MethodInfo type and came across this type and
Reading through the Flickr API documentation it keeps stating I require an API key
Reading through wikipedia I came across the concept of Sprints in Agile development. From
Reading through Thinking in Java i stuck in ex:6 of Inner Classes chapter. Exercise
Reading through the existing unit testing related threads here on Stack Overflow, I couldn't
Reading through some of the questions here, the general concensus seems to be that
Reading through an Article about custom Objects: http://technet.microsoft.com/en-us/library/ff730946.aspx I wonder why i get a

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.