Table of truth
-
function main() { var a, b, c; document.write("abc"); document.write("<br>"); for (a = 0; a < 2; ++a) { for (b = 0; b < 2; ++b) { for (c = 0; c < 2; ++c) {
document.write(a, b, c + "\n"); document.write("<br>"); } }
}
return 0;
}main();
how to make the table with the cells (lines, tablers) and each element in the cell.
-
As an option, you need to add, you don't have to.
function main() { var a, b, c;
document.write("<table>");
var color = 'style="border:1px solid #00f; padding:3px 9px"';
document.write("<tr><td " + color + ">a</td><td " + color + ">b</td><td " + color + " >c</td></tr>");
for (a = 0; a < 2; ++a) {
for (b = 0; b < 2; ++b) {
for (c = 0; c < 2; ++c) {
document.write("<tr>");
document.write("<td " + color + ">" + a + "</td>");
document.write("<td " + color + ">" + b + "</td>");
document.write("<td " + color + ">" + c + "</td>");
document.write("</tr>");
}
}
}
document.write("</table>");
}main();