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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T21:06:50+00:00 2026-05-15T21:06:50+00:00

In Python, and maybe in Javascript, the boolean or and and operators return one

  • 0

In Python, and maybe in Javascript, the boolean or and and operators return one of the operands, instead of true or false.

  • In Python, one of the operands is returned: '' || 'hello' == 'hello'
  • In comparison, in PHP: '' || 'hello' == true;

Now,

  • How is this behavior of boolean operators called?
  • Does this also work in Javascript in all browsers?
  • 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-15T21:06:50+00:00Added an answer on May 15, 2026 at 9:06 pm

    As Ignacio’s answer points out, these are coalescing operators. || is the null coalescing operator, && is the null-safe coalescing operator (link to follow, if I can find one sorry, I can’t find a link).

    They should be available in all browsers – they are both defined in the ECMA-262 1st, 2nd, 3rd and 5th editions, most current Javascript implementations are based upon 3rd or 5th. From ECMA-262 3rd edition:

    The production LogicalANDExpression : LogicalANDExpression && BitwiseORExpression is evaluated as
    follows:
    1. Evaluate LogicalANDExpression.
    2. Call GetValue(Result(1)).
    3. Call ToBoolean(Result(2)).
    4. If Result(3) is false, return Result(2).
    5. Evaluate BitwiseORExpression.
    6. Call GetValue(Result(5)).
    7. Return Result(6).

    The production LogicalORExpression : LogicalORExpression || LogicalANDExpression is evaluated as
    follows:
    1. Evaluate LogicalORExpression.
    2. Call GetValue(Result(1)).
    3. Call ToBoolean(Result(2)).
    4. If Result(3) is true, return Result(2).
    5. Evaluate LogicalANDExpression.
    6. Call GetValue(Result(5)).
    7. Return Result(6).

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

Sidebar

Ask A Question

Stats

  • Questions 512k
  • Answers 512k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Section 7.5.3.1 (function member applicability) says nothing about whether a… May 16, 2026 at 5:37 pm
  • Editorial Team
    Editorial Team added an answer The function you're looking for is equal_range. This returns an… May 16, 2026 at 5:37 pm
  • Editorial Team
    Editorial Team added an answer The standard Servlet API doesn't offer facilities for that. Best… May 16, 2026 at 5:37 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

Can anyone direct me to a good Python screen scraping library for javascript code
I am documenting a library that has a Python component and a JavaScript component.
I've seen there are actually two (maybe more) ways to concatenate lists in Python:
I'm looking for way to write Javascript programs / scripts on desktop, not inside
I am using python and webapp framework in app engine for backend and flex
I have some html-page. There is a javascript which generates some content. I have
Is there a plug-in for Firefox that would allow user's Javascript code like Greasemonkey
Someone was recently raving about how great jQuery was and how it made javascript
Do you know about a tool to easily create documentation for both JavaScript and
So we're writing a full-text search framework MongoDb . MongoDB is pretty much javascript-native,

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.