下面的代码演示了JS中如何通过concat函数链接多个数组
<!DOCTYPE html>
<html>
<body>
<script>
var parents = ["Jani", "Tove"];
var brothers = ["Stale", "Kai Jim", "Borge"];
var children = ["Cecilie", "Lone"];
var family = parents.concat(brothers, children);
document.write(family);
</script>
</body>
</html>
上面的代码运行结果如下:
Jani,Tove,Stale,Kai Jim,Borge,Cecilie,Lone
更多信息请查看IT技术专栏