Truth Tables
let text2 = "";
let data2 = [
[0, 0],
[0, 1],
[1, 0],
[1, 1],
];
text2 += "AND\n";
for (let i = 0; i < data2.length; i++) {
let el1 = data2[i][0];
let el2 = data2[i][1];
text2 += el1 + " & " + el2 + " = ";
text2 += (el1 & el2).toString();
text2 += "\n";
}
text2 += "OR\n";
for (let i = 0; i < data2.length; i++) {
let el1 = data2[i][0];
let el2 = data2[i][1];
text2 += el1 + " | " + el2 + " = ";
text2 += (el1 | el2).toString();
text2 += "\n";
}
text2 += "XOR\n";
for (let i = 0; i < data2.length; i++) {
let el1 = data2[i][0];
let el2 = data2[i][1];
text2 += el1 + " ^ " + el2 + " = ";
text2 += (el1 ^ el2).toString();
text2 += "\n";
}
let data3 = [1,0]
text2 += "NOT\n";
for (let i = 0; i < data3.length; i++) {
text2 += "~" + data3[i] + "=" + ~data3[i] + "\n"
}
console.log(text2);