From: Alexander Ebert Date: Sun, 24 May 2015 13:59:46 +0000 (+0200) Subject: Using Array.prototype.slice() to clone an array X-Git-Tag: 3.0.0_Beta_1~2319 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=8fff2f4111e0be0d5fdccf15e62ce47faa53be11;p=GitHub%2FWoltLab%2FWCF.git Using Array.prototype.slice() to clone an array --- diff --git a/wcfsetup/install/files/js/WoltLab/WCF/Core.js b/wcfsetup/install/files/js/WoltLab/WCF/Core.js index 811a7189e8..f64496a865 100644 --- a/wcfsetup/install/files/js/WoltLab/WCF/Core.js +++ b/wcfsetup/install/files/js/WoltLab/WCF/Core.js @@ -18,14 +18,7 @@ define([], function() { }; var _cloneArray = function(oldArray) { - var i = oldArray.length; - var newArray = new Array(i); - - while (i--) { - newArray[i] = oldArray[i]; - } - - return newArray; + return oldArray.slice(); }; var _cloneObject = function(obj) {