I am trying to make filtration on the website (for my practice) but It is printing the console as the times I have written but it is printing the Html once. can anyone tell me where I am wrong.... Thanks in advance.
Here's some code
var items = [
{img:"https://cdn.pixabay.com/photo/2014/08/05/10/27/iphone-410311__340.jpg"},
{img:"https://cdn.pixabay.com/photo/2014/05/02/21/50/laptop-336378__340.jpg"},
{img:"https://cdn.pixabay.com/photo/2015/03/26/09/41/phone-690091__340.jpg"},
{img:"https://cdn.pixabay.com/photo/2015/01/20/13/13/ipad-605439__340.jpg"},
{img:"https://cdn.pixabay.com/photo/2014/08/05/10/27/iphone-410311__340.jpg"},
]
let container = document.querySelector(".whole-wrapper")
for(let a = 0;a<=4;a++){
container.innerHTML = `<div class="stuff-container">
<h3>The Ultimate Iphone</h3>
<img src="${items[a].img}" alt="Phone" class="phone-img">
<p>The Mobile With Ultimate Speed</p><br>
<h4>In Just 50000 rupees</h4>
</div>
`
console.log("hello")
}
*,::before,::after{
margin:0;
padding:0;
box-sizing:border-box;
font-family:arial;
}
.whole-wrapper{
width:95%;
height:auto;
border:2px solid red;
margin:0 auto;
}
.stuff-container{
text-align:center;
display:inline-block;
/* border:5px solid green; */
}
.phone-img{
width:350px;
height:auto;
margin-left:50px;
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>A Great Demo on CodePen</title>
</head>
<body>
<div class="whole-wrapper">
</div>
</body>
</html>