JSFiddle - React, Tailwind, and code Playground
HTML
<div id="demo">
</div>
JavaScript
var config = {
47: 0,
48: 0,
49: 0,
50: 0,
53: 3
};
var reduced_config = {};
var min_qty = 4;
var max_qty = 8;
var i = 1;
for (const [key, value] of Object.entries(config)) {
if ( value > 0 ) {
reduced_config[key] = value;
}
}
reduced_config.fill("Kiwi", 2, 4);
console.log(reduced_config);
console.log(Object.keys(reduced_config).length);
const fruits = ["Banana", "Orange", "Apple", "Mango"];
document.getElementById("demo").innerHTML = fruits.fill("Kiwi",2,4);
//array.fill(value, start, end)
do {
//console.log(i);
i++;
} while (i <= max_qty );