Skip to content
Snippets Groups Projects
Commit d80e63ce authored by Arkerthan's avatar Arkerthan
Browse files

simplify assembleList()

parent 5c469480
No related branches found
No related tags found
1 merge request!6120Convert arcology building to full DOM [Ready for review]
...@@ -159,17 +159,15 @@ function addA(word) { ...@@ -159,17 +159,15 @@ function addA(word) {
* @returns {string} * @returns {string}
*/ */
function assembleList(items) { function assembleList(items) {
switch (items.length) { if (items.length === 0) {
case 0: return "none";
return "none"; } else if (items.length === 1) {
case 1: return items[0];
return items[0]; } else {
case 2: const last = items.pop();
return `${items[0]} and ${items[1]}`; let r = items.join(", ");
return `${r} and ${last}`;
} }
const last = items.pop();
let r = items.join(", ");
return `${r} and ${last}`;
} }
/** /**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment