From: David ‘Bombe’ Roden Date: Sun, 24 Nov 2019 10:43:23 +0000 (+0100) Subject: 🎨 Use better implementation, fix comment X-Git-Tag: v81^2~23 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=0e3bd6583c5e987027e3a50a61547dd23ee3ea30;p=Sone.git 🎨 Use better implementation, fix comment --- 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) } /**