Vahan60,
const inset = [
["apricot", "apple", "avocado", ],
["butterfly", "bug", "bear"],
["crow", "cat", "cup"]
];
let activeCell = 0;
let cell = document.querySelectorAll(".cell");
let fond = document.querySelectorAll(".fond");
let fond0 = document.querySelectorAll(".fond0");
let room = document.querySelectorAll(".room");
let pic = document.getElementById("pic");
for (let i = 0; i < cell.length; i++) {
cell[i].addEventListener("click", function() {
activeCell = i;
show();
})
};
function show() {
for (let j = 0; j < fond.length; j++) {
fond[j].src = `pic/${inset[activeCell][j]}.webp`
};
}
for (let j = 0; j < room.length; j++) {
room[j].addEventListener("click", function() {
fond0.src = `pic/${inset[activeCell][j]}.webp`;
});
};