利用concat进行数组复制

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>数组复制</title>
</head>
<body>
    <script type="text/javascript">
        var arr1 = [1,3,5,6,7];
        var arr2 = arr1.concat([]);
        arr2.push(10,50);
        alert(arr2);
        alert(arr1);
    </script>
</body>
</html>

 

posted @ 2016-05-18 22:50  黑客PK  阅读(534)  评论(0编辑  收藏  举报