Hello, in this JavaScript video, I am going to show you bitwise operators, these, you know, are really, really quick. So a bitwise operator, actually, you know, operates on a binary level. Let me just show you. So if I create two variables and call it one, sign the value of 12 equals eight for example, and let's console dot log. The first operator that I'm going to cover in the bitwise operator, tours is the end operator. And this is different to the end operator from the logical operator.
One, you write it with a single ampersand and the axon binary level unfortunately with a true or false actually, it is both Pause on the binary level. Again, let me show you for number one. And number two, let's see what we get. We get eight. And my thinking, Well, how do you actually let me choose slightly different numbers 2720 to get at, okay. You're probably thinking, you know, if you don't know about binary operation, then bitwise operators What the hell is going on?
So let me just actually write these out in binary. Then here before I do that environment, so 27 in binary, and let me just say 124, a 16. Yeah, we can actually just do a five bit four bit binary. So we can just do a 16 eight, one, so to get 27 to get 27 We need to put a one here, one here, so we get 24 not one there, we put a zero or a one there and put a one there. So we get three in them please copy this, that two and a two in binary is 1624, two big 2022 and there we go. Okay.
So these are the numbers in binary. So what it does is it puts them you can think of it like on top of each other for 27 and 22. And then what it does is it says that one and zero all they both, you know, on the boat No, they're not. So one second, let me just put zero everywhere now changes on E two. So one zero isn't on. So it becomes a zero.
Is one on one. Yes. One is 01 on? No, because only one of them is truly zero is one and zero true. No, because it's the hand operator both need to be true. The zero is one on one true Yes, they are both true.
So we get 16 plus two, which is 18. And that's how you get the 18. Right here. There is a new operator, which is the bitwise operator. And this is the single pipe there the exclusive OR operator the bitwise, not the left and right shift and white shift with zero as well. The principle is very similar if you watch the logical operator video, and there's really no point me just going over this again, along with you understand what's going on here, what's going on here and the logical operator video.
You'll be Good to go. What I will do is provide a link with this tutorial, which takes you to some amazing resources on bitwise operators how to use the other ones and you know a bit more in depth if you're interested in that and hopefully you are fans watching. If you have any questions, feel free to drop me a message. There'll be a link to the GitHub page as well and I look forward to seeing you in the next video.