JavaScript Bitwise Operators

Full Stack Web Development Courses with Real-time projects Start Now!!

Program 1

/* 
    Bitwise
    & -   and   | - or      ^ -  x-or    ~ not     

    <<  left shift 
    >>  right shift 
    >>> right shift with zero fill

    0101
    0011
    -------------
    0001

    1100
    0011
    -------
    1111

    0110
    0011
    -------
    0101
*/
// a=5 & 5
// console.log(a)
// a=12 | 12
// console.log(a)
//   a= 6 ^ 3
//   console.log(a)
//   a= -7 ^ -7
//   console.log(a)
// a=-5 & -2
// console.log(a)
// a=~-7
// console.log(a)

// a=5<<3
// console.log(a)
a=-1>>>29
console.log(a)

 

Did we exceed your expectations?
If Yes, share your valuable feedback on Google

courses

DataFlair Team

DataFlair Team provides high-impact content on programming, Java, Python, C++, DSA, AI, ML, data Science, Android, Flutter, MERN, Web Development, and technology. We make complex concepts easy to grasp, helping learners of all levels succeed in their tech careers.

Leave a Reply

Your email address will not be published. Required fields are marked *