const container = document.querySelector('.section')
let wrapper = null;
[...document.querySelectorAll('.item')].forEach((el, i) => {
if (i % 4 === 0) {
wrapper = document.createElement('div')
container.appendChild(wrapper)
}
wrapper.appendChild(el)
})
function inArray(arr, str) {
return arr.filter(function(item) {
return item.indexOf(str) !== -1
})
}
var words = inArray(libraryLetter, 'a')
if (words.length > 0 ) {
console.log(words)
} else {
console.log('Совпадений не найдено')
}