Sriker Ch Sriker Ch - 4 months ago 10x
Javascript Question

Filtering in JavaScript or jQuery

I am trying to take the data from the JSON file (link to file).
If I have to sort by the name or by the year of release, how to filter
the contents in that 2D array.

Can anyone please help me to sort this out.


Using jQuery.get() to get your api response, and than sort using Array.prototype.sort().

Sort by Year:

$.get("", (result) => {
    result.Search.sort((a, b, by) => {
        return a.Year < b.Year ? -1 : a.Year > b.Year ? 1 : 0;
<script src=""></script>