There is an array where rows of elements have the same text at the beginning, for example:
var myArray = [ "28|Какой то текст 1", "28|Какой то текст 2", "28|Какой то текст 3", "42|Какой то текст 4", "42|Какой то текст 5", "Фото1|Какой то текст 6", "Фото1|Какой то текст 7" ];
It is necessary to unite into groups (probably through two-level arrays?) All elements that start at 28 , all that start at 42, and all that start at Photo1 in this way to display them on the page in the following form:
28: Какой то текст 1 Какой то текст 2 Какой то текст 3 42: Какой то текст 4 Какой то текст 5 Фото1: Какой то текст 6 Какой то текст 7
The text at the beginning can be both a number and the actual text. The result is ultimately necessary without all the commas, brackets and round brackets to display in the textarea, where it will be copied to the clipboard, and then pasted into a plain text document