Откуда надо достать тексты:
const elements = document.querySelectorAll('.list li');
// или
const elements = document.querySelector('.list').children;
Достаём:
const str = Array
.from(elements, n => n.textContent)
.join(' ');
// или
const str = ''.concat(...Array.prototype.flatMap.call(
elements,
(n, i) => [ i ? ' ' : '', n.innerText ]
));
// или
const str = [...elements].reduce((acc, n, i) => {
return acc + (i ? ' ' : '') + n.innerHTML;
}, '');
// или
const str = (function get(i, n = elements.item(i)) {
return n
? `${i ? ' ' : ''}${n.lastChild.nodeValue}${get(-~i)}`
: '';
})(0);