kar diya solve much cleaner now. ab bas edit ka feature add krna hai
function getMovieObjectWithCardIndex(card) {
let index = card.dataset.index;
return library[index];
}
function updateInfo(e, card) {
const info = document.getElementById("info");
const movie = getMovieObjectWithCardIndex(card);
const textOfInfo = (i, text) => {
[...info.children][i].children[1].textContent = text;
};
for (let i = 0; i <= 4; i++) {
const cardText = Object.values(movie)[i];
textOfInfo(i, cardText);
}
}