А где у вас хранятся названия, которые вы хотите выводить в модальном окне?
let nameOneItem = new Item('Name one');
let nameTwoItem = new Item('Name two');
<div><img src="https://picsum.photos/30"><span>Name one</span></div>
<div><img src="https://lorempixel.com/30/30/technics"><span>Name two</span></div>
let imgCat = $(this).parent().find('img').attr('src');
let nameOneItem = new Item('Name one');
let nameTwoItem = new Item('Name two');
<div><img src="https://picsum.photos/30"><span>Name one</span></div>
<div><img src="https://lorempixel.com/30/30/technics"><span>Name two</span></div>
let Item = function(name) {
this.name = name;
}
for (let i in name) {
modalCat += '<div class="modal-item">'
modalCat += '<img src="' + imgCat + '">'
modalCat += '<span class="name-item">' + name[i] + '</span>'
modalCat += '<span class="remove-item"><i class="fa fa-times" aria-hidden="true"></i></span>'
modalCat += '</div>';
}
for (let i in name) {
modalCat += '<div class="modal-item">'
modalCat += '<img src="' + imgCat + '">'
modalCat += '<span class="name-item">' + name[i] + '</span>'
modalCat += '<span class="remove-item"><i class="fa fa-times" aria-hidden="true"></i></span>'
modalCat += '</div>';
}
modalCat += '<span class="name-item">' + name[i] + '</span>'
let nameOneItem = new Item('Name one');
let nameTwoItem = new Item('Name two');
const icon = $('.icon-right');
const modal = $('.modal');
let Item = function(name) {
this.name = name;
nameItem(this.name);
}
function nameItem(name) {
$('.move').click(function() {
let imgCat = $(this).parent().find('img').attr('src');
let modalCat = '';
for (let i in name) {
modalCat += '<div class="modal-item">'
modalCat += '<img src="' + imgCat + '">'
modalCat += '<span class="name-item">' + name[i] + '</span>'
modalCat += '<span class="remove-item"><i class="fa fa-times" aria-hidden="true"></i></span>'
modalCat += '</div>';
}
if ($('.move').is(this)) {
if (!modal.children().is('.modal-item')) modal.text('Каталог');
} else {
modal.removeClass('show-item').text('Здесь ничего нет');
}
modal.addClass('modal-open').append(modalCat);
setTimeout(function() {
$('.modal-item').addClass('show-item');
}, 80);
})
}
let nameOneItem = new Item('Name one');
let nameTwoItem = new Item('Name two');
let nameOneItem = new Item('Name one');
let nameTwoItem = new Item('Name two');
modalCat += '<span class="name-item">' + name[i] + '</span>'
let nameOneItem = new Item('Name one');
let nameTwoItem = new Item('Name two');
let imgCat = $(this).parent().find('img').attr('src');
let modalCat = '';
for (let i in obj) {
modalCat += '<div class="modal-item">'
modalCat += '<img src="' + imgCat + '">'
modalCat += '<span class="name-item">Тут название из объекта new Item</span>'
modalCat += '<span class="remove-item"><i class="fa fa-times" aria-hidden="true"></i></span>'
modalCat += '</div>';
}
<div>
<p class="img"><img src="https://picsum.photos/30">
<button class="move">Переместить</button>
</p>
</div>
<div>
<p class="img"><img src="https://lorempixel.com/30/30/technics">
<button class="move">Переместить</button>
</p>
</div>
let nameOneItem = new Item(1, 'Name one');
let nameTwoItem = new Item(2, 'Name two');