javascript xor
//make an xor condition in javascript
if ((a && !b) || (!a && b)) {
}
javascript xor
//make an xor condition in javascript
if ((a && !b) || (!a && b)) {
}
|| in js
const a = 3;
const b = -2;
console.log(a > 0 || b > 0);
// expected output: true
right shift operator js
(A >> B) == Math.floor(A / (2 ** B)) == Math.floor(A / Math.pow(2, B))
javascript bitwise flags
var myEnum = {
left: 1,
right: 2,
top: 4,
bottom: 8
}
var myConfig = myEnum.left | myEnum.right;
if (myConfig & myEnum.right) {
// right flag is set
}
>> js
The right shift operator (>>) shifts the first operand the specified number
of bits to the right. Excess bits shifted off to the right are discarded.
Copies of the leftmost bit are shifted in from the left. Since the new
leftmost bit has the same value as the previous leftmost bit, the sign bit
(the leftmost bit) does not change. Hence the name "sign-propagating".
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us