hey guys. I need some help with some OR and XOR operators.
For OR, I am trying to get 0 1 = 1. My code works for other options but not this one.
if(a === 0 || b === 1) {
return a;
} else if (b === 1 || a === 1) {
return a;
} else
return b - a;
}
I am also trying to get the results 0 0 = 1, 1 0 = 1 and 1 1 = 0
function nor(a, b) {
if(a !== 0 || b !== 0) {
return a;
}else if(a !== 1 || b !== 0) {
return a;
}else{
return b;
}
}
Any help is appreciated!