I would like to be able to search, filter and sort in an object. Below is the code of the object. I have an input field where I can search in the object. It is also the intention that I can indicate what I want to search + ascending or descending.
In the picture you can see what the html looks like.
This is the code to search and sort
const users = [{
id: 1,
name: "Jan",
age: 17,
city: "Dublin",
},
{
id: 2,
name: "Bob",
age: 17,
city: "London",
}
]
<form action="#" method="post" id="filters">
<label for="search">Search</label><input type="search" name="search" id="search" />
<label>Sort items by
<select id="sortby" name="sortby">
</select>
</label>
<select id="direction" name="direction">
<option value="asc">ascending</option>
<option value="desc">descending</option>
</select>
</form>