本文實例講述了javascript數組克隆簡單實作方法。分享給大家參考,具體如下:
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <title>新建网页 1</title> </head> <body> <script language=javascript> var a = ['a','b','c','d','e','f']; var b = a.concat(); b.push('test is ok!'); alert(b.join(',')); alert(a.join(',')); </script> </body> </html>
希望本文所述對大家JavaScript程式設計有所幫助。