<div class="block">
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>
</div>
<div class="block">
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>
</div>
.block{
display:flex;
}
.item{
width: 50px;
height: 50px;
background:orange;
margin:5px;
}
const blocks = document.getElementsByClassName('block');
const stats = [];
for(block of blocks) {
const size = block.getElementsByClassName('item').length;
stats.push(size);
}
alert(stats);
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.