Solución
JL@juanluisabreu_4c541ef6
·4/4/2026TypeScriptsolution.tsTypeScript
function logicGate(firstValue: boolean, secondValue: boolean, gate: "AND" | "OR" | "XOR" | "NAND"): boolean {
let evaluar = gate == "AND"? firstValue + " && " + secondValue:
gate == "OR"? firstValue + " || " + secondValue:
gate == "XOR"? "!(" + firstValue + " || " + secondValue + ")":
"!(" + firstValue + " && " + secondValue + ")";
return eval(evaluar);
}
// No modificar: necesario para evaluar el resultado.
export { logicGate };0respuestas