so I have an array in my code below but one of my requirements for the assignment is to have a very LARGE array of objects around like 10,000 objects. My teacher was saying that the computer can just keep generating random objects for you given how many you want so in my case like 10,000. I'm just confused about how I would do that, any help or suggestions are really appreciated thank you!
class Shoe {
constructor(name, price, type) {
this.name = name;
this.price = price;
this.type = type;
}
}
var shoes = [
new Shoe('Nike AirMax 90', '120', 'Casual'),
new Shoe('Jordan Retro 1', '110', 'Casual'),
new Shoe('Jadon Doc Martens', '250', 'Seasonal boots'),
new Shoe('Adidas X Ghosted', '110', 'Athletic'),
new Shoe('Nike Vapourmax Flyknit', '250', 'Casual'),
new Shoe('Aldo Loafers', '130', 'Formal'),
new Shoe('Timberlands', '199', 'Seasonal boots'),
new Shoe('Converse High Tops', '70', 'Casual'),
new Shoe('Converse Low Tops', '80', 'Casual'),
new Shoe('Adidas NMDs', '110', 'Athletic'),
new Shoe('Heels', '130', 'Formal'),
new Shoe('Nike AirForce', '150', 'Casual')
];
function bubbleSort(shoes) {
var swapped;
do {
swapped = false;
for (var i = 0; i < shoes.length - 1; i++) {
if (+shoes[i].price > +shoes[i + 1].price) {
var temp = shoes[i];
shoes[i] = shoes[i + 1];
shoes[i + 1] = temp;
swapped = true;
}
}
} while (swapped);
return shoes;
}
bubbleSort(shoes);
console.log('Bubble Sort:\n', shoes);