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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T16:20:26+00:00 2026-06-15T16:20:26+00:00

In lamens terms, what does a bitwise | operator do in Javascript and why

  • 0

In lamens terms, what does a bitwise | operator do in Javascript and why is:

8 | 1 ; //9
  • 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-15T16:20:27+00:00Added an answer on June 15, 2026 at 4:20 pm

    8 in binary = 1000
    1 in binary = 0001

    if you take each binary digit and treat them as if statements (1 being true and 0 being false), you get this:

    1 || 0 = 1
    0 || 0 = 0
    0 || 0 = 0
    0 || 1 = 1
    

    and the result is 1001, which is 9 in decimal

    If it had been 8 & 1, it would go like this:

    1 && 0 = 0
    0 && 0 = 0
    0 && 0 = 0
    0 && 1 = 0
    

    and the result would be 0

    Here’s a quick example of how you might use these:

    You would use the OR operator if you wanted to combine masks –

    Using an example of file permissions, you may have the following flags:

    1st bit - execute (bin - 001, dec - 1)
    2nd bit - write (bin - 010, dec - 2)
    3rd bit - read (bin - 100, dec - 4)
    

    If you wanted to create a mask for read and execute, you’d do something like read value | execute value which is 1 | 4 which would give you 5 (101 in bin)

    Now you have a mask that you can check a file’s permissions to see if it has both of these permissions, using the & operator:

    Example file 1 (has read, write, and execute)

    Its permission value is 7 (111 in bin): 111 & 101 = 101, so it does have those perms

    Example file 2 (has read and write)

    Its permission value is 6 (110 in bin): 110 & 101 = 100, so it only has the 100 (4 in dec) perms (read) of the two provided from the mask

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

Sidebar

Related Questions

I was wondering what does the following sentence mean in laymens terms about the
I understand the host of issues in comparing floats, and lament their use in
Please forgive the length, but here are two programs, both the exact same, but
Please help, I'm going slightly mad!! I'm using Eclipse-generated antfiles to build a project
what are the benefits of using base types in method parameters? Here's one sample:
There's been so many topics I've read on this, but I have to just
Possible Duplicate: What are Extension Methods? I know this questions has been asked previously,
Good Morning All, Thank you for having a look at my question. To start
Low and behold, I ran into a regression in numpy.choose after upgrading to 1.5.1.
I'm checking a module with Pylint. The project has this structure: /builder __init__.py entity.py

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.