From 0e3bd6583c5e987027e3a50a61547dd23ee3ea30 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Sun, 24 Nov 2019 11:43:23 +0100 Subject: [PATCH] =?utf8?q?=F0=9F=8E=A8=20Use=20better=20implementation,=20?= =?utf8?q?fix=20comment?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/main/resources/static/javascript/sone.js | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/src/main/resources/static/javascript/sone.js b/src/main/resources/static/javascript/sone.js index 23c7fff..efd72a5 100644 --- a/src/main/resources/static/javascript/sone.js +++ b/src/main/resources/static/javascript/sone.js @@ -297,21 +297,14 @@ function getMenuSone(element) { /** * Generates a list of Sones by concatening the names of the given sones with a - * new line character (“\n”). + * comma. * * @param sones * The sones to format * @returns {String} The created string */ function generateSoneList(sones) { - var soneList = ""; - $.each(sones, function() { - if (soneList != "") { - soneList += ", "; - } - soneList += this.name; - }); - return soneList; + return sones.reduce((soneList, sone) => soneList + ", " + sone.name, "").substring(2) } /** -- 2.7.4