<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>table输出</title>
</head>
<body>
</body>
<script>
var persons=[['小米','25','1.70','女'],['小明','27','1.72','男']];
document.write('<table border="1" cellspacing="0" cellpadding="0">');
document.write('<tr><td>姓名</td><td>年龄</td><td>身高</td><td>性别</td></tr>');
for(var i=0;i<persons.length;i++){
var person=persons[i];
document.write('<tr>');
for(var j=0;j<person.length;j++){
document.write('<td>'+person[j]+'</td>');
};
document.write('</tr>');
};
document.write('</table>')
</script>
</html>
效果: