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

  • SEARCH
  • Home
  • 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 7051899
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T03:19:08+00:00 2026-05-28T03:19:08+00:00

Is bol === !0 exactly the same as bol == true ? Example: function

  • 0

Is bol === !0 exactly the same as bol == true?

Example:

function myFunction(bol){
    if(bol===!0){
        return 1;
    }else{
        return -1;
    }
}

alert(myFunction(true));//1

Will I ever run into problems if I decide to use it? (different than code readability)

  • 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-28T03:19:09+00:00Added an answer on May 28, 2026 at 3:19 am

    No. 1 == true is true but 1 === !0 is false.

    Since !0 is true, this is equivalent to bol === true. Note how you should still use the three equal signs to get exactly the same behavior.

    The === means JavaScript will not try to coerce the values when comparing. If you actually want to coerce, you would use ==. However, in this case, the if will just coerce for you:

    if (bol) { ... }
    

    is basically the same as

    if (bol == true) { ... }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

BOL states that SQL Server level 10 messages are Informational messages that return status
According to BOL (SQL Server Books Online) on sp_dbcmptlevel , This feature will be
Example: USE AnotherDB -- This works - same ID as from other DB SELECT
I have 2 Informix queries that I believe should return the same data but
Unfortunately the BOL is a little vague on this, but index_id = 0 on
According to MSDN BOL (Books Online) description on SOME | ANY (Transact-SQL) , SOME
According to BOL , SNAPSHOT Specifies that data read by any statement in a
First, from BOL : Queries that modify table variables do not generate parallel query
The error is cannot convert object to sql parameter I'm working with a bol->dal,
According to the following section of BOL: How to: Use Source Control with SQL

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.