i have a program that gets data from 2 fetched URLs, with CSS I automatically create a Business Card type design and it does that automatically in a 'for' loop. Now I need to create a Sort Alphabetical button by that "${users[count].name} and I do not have any idea how to do that.
Promise.all([
fetch('https://jsonplaceholder.typicode.com/photos'),
fetch('https://jsonplaceholder.typicode.com/users')
]).then(function (responses) {
return Promise.all(responses.map(function (response) {
return response.json();
}));
}).then(([ photos , users]) =>{
var names = document.getElementById('names')
for (let count = 0; count < 10; count++){
names.innerHTML+=`
<div class= "profile_card">
<div class=topCont>
<img class="thumbnail" src="${photos[count].thumbnailUrl}">
<div class="personal">
<h2 class="name">${users[count].name}</h5>
... etc
</div> </div>
`
After this i have some EventListeners but I do not this they matter. The idea is that i need to be able to sort these data that I print but I do not know how to store all of them in an Array and after that I thought about using a 'for' loop from 0 to 10 to output them by the number that resulted to be the lowest or something like that.