Luca,
<!DOCTYPE html>
<html>
<head>
<title>Untitled</title>
<meta charset="utf-8">
</head>
<body>
<div id="slider"></div>
<script>
"use strict"
let threeDivs = {
div1:{
text: "it's div1"
},
div2:{
text: "it's div2"
},
div3:{
text: "it's div3"
}
}
Object.keys(threeDivs).forEach(function(elem) {
let div = document.createElement("div")
div.innerHTML = threeDivs[elem].text;
div.addEventListener("click", (e)=>{
document.body.removeChild(div);
delete threeDivs[elem];
console.log(threeDivs)
});
document.body.appendChild(div)
})
</script>
</body>
</html>