Untitled
unknown
plain_text
a year ago
668 B
17
Indexable
function generateItems(count) {
const names = ["John", "Jane", "Ivan", "Mario", "Hans", "Chen", "Emily", "Liam", "Sophia", "Oliver"];
const countries = ["USA", "Germany", "China", "Italy", "Ukraine", "France", "Canada", "Spain", "Japan", "Brazil"];
const items = [];
for (let i = 0; i < count; i++) {
const name = `${names[Math.floor(Math.random() * names.length)]} ${String.fromCharCode(65 + Math.floor(Math.random() * 26))}.`;
const country = countries[Math.floor(Math.random() * countries.length)];
items.push({
id: i + 1,
name,
country
});
}
return items;
}
const items = generateItems(3000);
console.log(items);
Editor is loading...
Leave a Comment