Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
  <meta charset="utf-8">
  <title>JS Bin</title>
</head>
<body>
  
   
  
</body>
</html>
 
body {
  font-family: Consolas, monospace;
}
table {
  border-collapse: collapse;
}
td {
  border: 1px solid #dcdcdc;  
  padding: 8px 12px;
}
 
console.clear();
var x = 10;
var result = [];
var html = "";
function random(min, max) {
  return Math.floor(Math.random() * (max - min + 1)) + min;
}
function write(t) {
  document.body.innerHTML += t;
}
html += "<table>";
for (var i = 0; i < x; i++) {  
  result[i] = [];
  html += "<tr>";
  for (var j = 0; j < x; j++) {    
    result[i][j] = random(1, 4);
    html += "<td>" + result[i][j] + "</td>";
  }
  html += "</tr>";
}
html += "</table>";
write(html);
Output

This bin was created anonymously and its free preview time has expired (learn why). — Get a free unrestricted account

Dismiss x
public
Bin info
anonymouspro
0viewers