adding a condition to this array

You can use the filter function to remove data you don’t want in a array:

var selectionList = document.querySelectorAll(".selected-text");
myFormItems.value = [...selectionList].map(el=>el.textContent).filter(txt=>txt !== 'None').join('\n');

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top