💻 JavaScript 구현 예제
// 논리 게이트 함수들
function AND(a, b) { return a && b; }
function OR(a, b) { return a || b; }
function NOT(a) { return !a; }
function XOR(a, b) { return (a && !b) || (!a && b); }
function NAND(a, b) { return !(a && b); }
function NOR(a, b) { return !(a || b); }
// 현재 입력값
const A = false, B = false;
// 결과 계산
console.log('AND:', AND(A, B)); // false
console.log('OR:', OR(A, B)); // false
console.log('NOT A:', NOT(A)); // true
console.log('XOR:', XOR(A, B)); // false
console.log('NAND:', NAND(A, B)); // true
console.log('NOR:', NOR(A, B)); // true