From 8fff2f4111e0be0d5fdccf15e62ce47faa53be11 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Sun, 24 May 2015 15:59:46 +0200 Subject: [PATCH] Using Array.prototype.slice() to clone an array --- wcfsetup/install/files/js/WoltLab/WCF/Core.js | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) 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) { -- 2.20.1