This is the codeAbility Sharing Platform! Learn more about the codeAbility Sharing Platform.

Skip to content
Snippets Groups Projects
Commit e7c4f490 authored by Daniel Rainer's avatar Daniel Rainer
Browse files

Simplify arrayToString

This removes the <br> tags which were
previously inserted after every five elements.
Line breaks should be handled dynamically
by the browser.
parent 3fbc5e0c
Branches
2 merge requests!188Merging Peer Reviewing et. al to Master,!164211 peer reviewing functionality
......@@ -16,18 +16,10 @@ export class ExerciseMetadataListItemComponent implements OnInit {
public arrayToString(array: string[]): string {
let result = '';
let i = 1;
array.forEach(element => {
if (array.length > 1 && array.length !== i) {
result += element + ', ';
} else {
result += element;
}
if (i % 5 === 0) {
result += '<br>';
}
i++;
});
for (let i = 0; i < array.length - 1; ++i) {
result += array[i] + ', ';
}
result += array[array.length - 1];
return result;
}
}
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment