const prod = [{
name: "Sweat",
description: " collection",
price: 150,
},
{
name: "Trousers",
description: "Attire",
price: 243
},
{
name: "T-shirt",
description: "Winter",
},
{
name: "Hoody",
description: "Fashion",
},
{
name: "Pants",
description: "Winter",
},
{
name: "Casual",
description: "Winter",
price: 245,
},
{
name: "Shirt",
description: "Attire",
price: 150,
}
];
Hi, I'm trying to add a random popularity score between 0 - 100, randomly for the products without them using a function.
I've tried to figure out solutions from
https://levelup.gitconnected.com/set-data-structure-in-javascript-62e65908a0e6
and
https://medium.com/front-end-weekly/getting-a-random-item-from-an-array-43e7e18e8796
but still unsure how to add elements to specific indices without the 'popularity' element. Thanks!