столкнулся с проблемой. Необходимо из функции Tools
передать один из item
'ов в массив Bag
функции Equipment
.
function Equipment() {
const Bag = [];
function addProduct() {
for (var i=0; i < tools; i++) {
Bag.push(tools.item1)
}
}
}
function tools() {
this.item1 = {
name: "item1",
price: 5,
count: 10
};
this.item2 = {
name: "item2",
price: 15,
count: 20
};
this.item3 = {
name: "item3",
price: 20,
count: 30
};
this.item4 = {
name: "item4",
price: 30,
count: 40
};
this.item5 = {
name: "item5",
price: 40,
count: 50
};
}
const equipment = new Equipment();
const tools = new Tools(/* … */);
equipment.addTools(tools)