js遍历二维数组


查看demo实例
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="http://blog.1500km.com/sites/ui-blog/other/favicon.ico" rel="shortcut icon" />
<link href="http://blog.1500km.com/sites/ui-blog/other/favicon.ico" rel=bookmark />

<script type="text/javascript">
var list=[
          ['tom','male']
         ,['jim','male']
         ,['lily','female']
         ,['watson','male']
         ,['lucy','female']
         ,['john','male']
];

for(k in list){
         for(m in list[k]){
                  document.write(list[k][m]+'('+k+','+m+') | ');
         }
         document.write('<hr>');
}

</script>


程序运行结果如下,查看demo实例